angularjs - Non-Flickering Polling in Angular with REST Backend -


i managed getting constant polling of backend functional using this answer.

but on every timeout ui flickering (empty model short time). how can update model (and view respectively) after new data arrived in order avoid flickering effect?

here current controller (slightly modified step_11 (angular.js tutorial)):

function mypollingctrl($scope, $routeparams, $timeout, model) {  (function tick() {     $scope.line = model.get({         modelid : $routeparams.modelid     }, function(model) {         $timeout(tick, 2000);     }); })();  } 

// edit: i'm using current stable 1.0.6 of angular.js

try updating data in success callback. this:

(function tick() {     model.get({         modelid : $routeparams.modelid     }, function(model) {         $scope.line = model;             $timeout(tick, 2000);     }); })(); 

this should prevent flicker occurring when $scope.line empty model resource fetching data.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -