简体   繁体   中英

What is the best way for updating angular ng-repeat data values between view and controller?

How to update data for ng-repeat between view and controller? If I put:

ng-repeat="item in actions"

And if I change $scope.actions in controller to some other value, would it be updated in ng-repeat? Is this the best way to update data values for ng-repeat between view and controller?

ng-repeat is slow, you will know when you have good amount of data to start researching about better performance of ng-repeat.

You first question

if I change $scope.actions in controller to some other value, would it be updated in ng-repeat?

Yes, however if it doesn't work use angular's '$timeout'

$timeout(function(){
  $scope.actions = [];
},0)

Your second question

Is this the best way to update data values for ng-repeat between view and controller?

it is the best way though it is suggested supplementing ng-repeat with limitTo together with Infinite scrolling .

Take a look at this stack overflow question

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM