AngularJS ng-repeat view not updating after data update -


have data 1 page in ng-repeat. when page , data 1st loads data shows up. when move away page (using angular routing) make change data (gets saved in db) come page (make call db new data) ng-repeat data not refresh. can see new data loading array , new data.

i start process on page

var sp = this; sp.viewdata = []; sp.employee = []; sp.viewdatatwo = []; $(document).ready(function () {     var testheader = setinterval(function () { mytimer() }, 1000);     function mytimer() {         if (addheadertoken() != undefined) {             clearinterval(testheader);             sp.usagetext = "";             if (sessionstorage.getitem(tokenkey) != null) {                 sp.associatedinfo = json.parse(getassociatedinfo());                    loaddataone();                  loaddatatwo();             }         }     } }); 

i because need security toke js script have no power on changes. need make sure code has ran me token.

here functions call..

function loadpasses() { $http.defaults.headers.common.authorization = "bearer " + addheadertoken(); $http.get('/api/employee/xxx', { params: { employeeid: sp.employeeid } }).then(function (data) { sp.viewdata = data.data; (var = 0; < $scope. viewdata.length; i++) {             sp.passes[i].sortdatedisplay = (data.data.status == "active" ? data.data.datestart + "-" + data.data[i].dateend : data.data[i].visitdate);             sp.passes[i].sortdate = (data.data[i].status == "active" ? data.data[i].datestart: data.data[i].visitdate); }    }); }   function loaddatatwo () {     $http.defaults.headers.common.authorization = "bearer " + addheadertoken();     if (sessionstorage.getitem(tokenkey) != null) $http.get('/api/employee',     {         params: { employeeid: sp.employeeid }     }).then(function (data) {         sp.employee = data.data;         var temppassstring = "";         sp.viewdatatwo = [];         var totala = 0;         var totalu = 0;          (var p = 0; p < sp.employee.datax.length; p++) {             sp.viewdatatwo.push(sp.employee.datax[p].description + "(" + /** math update description **// + ")");             totala += parseint(parseint(sp.employee.datax[p].anumber));             totalu += parseint(sp.employee.datax[p].bnumber));         }         sp.usagearr.push(" total: " + totala- totalu) + "/" + totala + " available");          //$scope.$apply();      }); } 

one view sp.viewdata , sp.viewdatatwo both in ng-repeats. works on load.. when go out , come in. see data reloading. view not. have hacked dom work now. right way.. help. have used $scope.$apply(); tells me digest in process;

the views in template.. please help


Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

Kivy: Swiping (Carousel & ScreenManager) -