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
Post a Comment