angularjs - reload page after 3 seconds using Angular -
the following controller of page developing.
rp3.controller('c1ctrl', [ '$scope', 'xfactory', '$timeout', '$route', function($scope, xfactory, $interval, $timeout, $route) { var layout_url = "json/dashboard/layout/mpu/layout.json"; xfactory.getjson(layout_url, function(layout) { // read // layout's // web // service $.each(layout, function(i, val) { chart.push({ "v" : val, "x" : xfactory }); // alert(chart[0]); var ctype = getcharttype(val.charttype); // alert(ctype); drawlayout(parentdiv.name, val.position, val.width, val.height, val.title, val.color, val.bgcolor, buttomctrl.withctrl, ctype); filllayoutdata(xfactory, val.position, val.url, val.height, ctype); }); }, function() { console.log("connection! "); }); $timeout(reloadpage, 3000); var reloadpage = function() { $route.reload(); } } ]);
here, trying reload page this:
$timeout(reloadpage, 3000); var reloadpage = function() { $route.reload(); }
it can seen way handle page reload wrong. how can correctly implemented?
you define reloadpage
after using it. switch lines:
var reloadpage = function() { $route.reload(); } $timeout(reloadpage, 3000);
or simpler:
$timeout($route.reload, 3000);
Comments
Post a Comment