when update $scope in controller
$scope.item = "hello"; then whole dom item seems removed , added again. seems fine, if have list of items , do
$scope.items = resource.query(); to update items of dom items removed , re-added, looks broken , clumsy - there anyway around removing , adding of dom elements when $scope updated?
this issue further exasperated if $scope.items , children used inside several ng-repeat statements of ng-repeat sections removed , re-added.
edit
i have read , feel issue https://www.binpress.com/tutorial/speeding-up-angular-js-with-simple-optimizations/135
that have "stuff" going on $digest slow. working on example in mean time imagine try of data
{ { id: 1, name: "name1", something: { id: 10, name: "something10" else: { id: 15, name: "else15" } } } } but there 20 such objects nested objects - appears issue. there many objects being parsed , bound dom $watchers taking long time go on everything.
edit 2
i made demo, perhaps using resource wrong? http://plnkr.co/edit/qoickl0dyi8jmuvg9mzn
but items replaced every 5 seconds, on replace disappear , reappear. issue having.
if you'll take @ $resource documentation, you'll see correct way of manipulation data - use callback function
instead of
$scope.items = resource.query(); try
resource.query(function(data) { $scope.items = data; });
Comments
Post a Comment