javascript - angularjs, how to update $http.post for the second time, ng-repeat?
習慣沉默
習慣沉默 2017-05-16 13:19:22
0
3
551

I just started using angularjs, and now paging and querying are done by the background,
So I think it might be good if I use $http again to update $scope
But now ng-repeat is in search( ) I can receive the data and the page does not change
This is my current code.
js

app.controller('checkpoint', function($scope, $http) { //getData to list $http({ method: 'post', url: '../list', }).then(function successCallback(response) { $scope.checkpoint = response.data.datas.list; }, function errorCallback(response) { console.log('请求错误'); }); //search $scope.search = function (){ $http({ method: 'post', params :{keyword:$scope.query}, url: '../list', }).then(function successCallback(response) { console.log(response.data.datas.list) $scope.checkpoint = response.data.datas.list; }, function errorCallback(response) { console.log('请求错误'); }); }; });

html

... {{ x.projectCode }} {{ x.station }} {{ x.code }} {{ x.circuit }} {{ x.name }} {{ x.item }} {{ x.description }} {{ x.watchedAssetCode }} ...

習慣沉默
習慣沉默

reply all (3)
Ty80

Where is the search method triggered?

    世界只因有你

    I discovered during inspection that there is an extra

    in the middle of the layout which was not visible on the page

      Ty80

      Maybe angular needs to be compiled again, and there are many pitfalls. . .

      htmlContent = $compile(htmlContent)($scope);
        Latest Downloads
        More>
        Web Effects
        Website Source Code
        Website Materials
        Front End Template
        About us Disclaimer Sitemap
        php.cn:Public welfare online PHP training,Help PHP learners grow quickly!