Friday, 15 August 2014

angularjs - Preserve the state of a directive within ng-repeat -



angularjs - Preserve the state of a directive within ng-repeat -

let's have this:

<div ng-repeat="item in list"> <div change-color>some content</div> </div>

where directive "changecolor" can alter background color of div clicking it.

if alter content of list, http-request overwrites whole list:

$scope.list = newlist;

my "changecolor" directive "reloads", since divs repopulated, possbile, angular-way preserve state of div (by directive has changed it) or need manually?

p.s.

this useful since in situation have huge list of items user wants interact each item in way above, list overwritten each 30 seconds , clears "changes" it's pristine state.

angularjs angularjs-directive ng-repeat

No comments:

Post a Comment