angular.js - After loading data using angular, clicking the button to add data cannot directly display the loaded data?
滿天的星座
滿天的星座 2017-05-15 16:55:48
0
1
612

I use angularjs $http to load some data. The data is displayed in pages, and then slides to load the next page, and then clicks the button to add data. There are some problems.
Assume that there are 10 pieces of data on one page. If the current page already has The data is less than 10, the data I added will be displayed directly, using

$scope.count = 1;
$scope.programs.unshift(data.content);

The array is added to the top
If the current data is greater than 10 items, the data I added cannot be displayed directly on the list, and some ng-click elements need to be clicked to display it

Note: There is a lot of code, so I won’t write it down. The main thing is to insert data at the top of all comments. When the data is larger than 1 page, it cannot be directly displayed after adding that a piece of data has been inserted. When it is smaller than one page, it will not be displayed. Problem, how to solve it? ? ?

滿天的星座
滿天的星座

reply all(1)
伊谢尔伦

I solved it myself, just add $scope.$digest(); and it’s OK

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template