javascript - DOM keeps being rebuilding with angular-selectize ng-repeat and track by -


i'm using angularjs angular-selectize module.

to populate page elements need use this:

index.html

<selectize     ng-repeat="select in selects_data track $index"     config="selectizeconfig"     options="select.options"     ng-model="selects_models[select.name]"> </selectize> 

controller.js

$scope.update_data = function(){     //i'm using angularjs resource json data server     $scope.selects_data = statestablecontrol.get({'path': $scope.element.path},         function(data){             //success             angular.foreach(data, function(item){                 $scope.selects_models[item.name] = item.current_id             });         }, function(error){             //error         }     ); };  $scope.update_data(); $interval($scope.update_data, 3000); 

no matter whether use track $index, track select.name or don't use @ all, of <selectize></selectize> elements redrawing every time update selects_data array data obtained server, if array content same after updating.

i haven't found recipe solve myself. , can't understand why track by helps same thing when use inside div or other elements.

i'll glad if can issue!

i don't think has way track items. if statestablecontrol.get returns new objects everytime call it, think angular considers they're different objects, if contain same data.

you send objects have changed, or maintain version number objects know ones haven't changed , don't replace them.


Comments

Popular posts from this blog

matlab - error with cyclic autocorrelation function -

django - (fields.E300) Field defines a relation with model 'AbstractEmailUser' which is either not installed, or is abstract -

c# - What is a good .Net RefEdit control to use with ExcelDna? -