javascript - How to single bind in ui-sref? -


i doing ng-repeat of list this:

<div ng-repeat="x in myctrl.data" ui-sref="app.detail({id: x.id})">     <img ng-src="{{::x.image}}">     <h2>{{::x.name | characters:35}}</h2> </div> 

when monitor watcher, found watcher increases when list getting longer. if remove {id: x.id} ui-sref, no matter how long list is, number of watcher remains same.

so, question how can single binding in ui-sref?

yes, if @ api come know that, adds watcher this line & can't avoid that.

you rid of watcher redirection state thing own, have ng-click="redirect('app.detail', {id: x.id})" event there instead of having ui-sref directive, , redirect method redirect state using $state.go.

code

$scope.redirect = function(statename, param){     $state.go(statename, param) } 

Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -