weixin_33717117 2017-05-26 05:54 采纳率: 0%
浏览 58

Ajax在Angular JS中重新加载

I have dropdown which generates items from json.

`generalService.getUrlData('get_data')
        .then(function(data){
            $scope.names = data.data;
            for (var i=0; i < $scope.names.length; i++) {
                var compn = $scope.names[i].NAME;   
                $scope.compname.push(compn);
            }
    });`

my question is when i entered a new data to db using typeahed combo box the newly entered data is not populating in the dropdown. It is populating after the page is reloaded. How to reload the ajax call when submit button is clicked, so that the newly entered item appears in dropdown without reloading the page.I hope you understood my question.

  • 写回答

3条回答 默认 最新

  • 乱世@小熊 2017-05-26 06:35
    关注

    you need to invoke new http request if you want to load new data from server to client.

    if your data just entered from consumer, you can avoid new request by simulating serverside update

    评论

报告相同问题?