javascript - how to refresh page to fetch new values from service using angular? -
i having page having 1 table , 2 charts , how refresh charts , tables while pressing refresh button , table , 2 different charts coming 3 different controllers on single page . want refresh of them able new values webservice again , recreate page accordingly click or single refresh button .
i have tried few ideas .
$scope.refreshchart = function(){ alert("refresh"); // $scope.dashloader = true; $state.go('plm.creator'); // $scope.dashloader = false; console.log("on page refresh called; not dashboard page"); }
but these not working per expectations , kindly help
one thing can try use $scope.$broadcast(name, args) broadcast event (event name string make up) controller can listen , run code refresh.
the controller listen $scop.$on(event, listener)
so 1 controller this:
$scope.$broadcast('myrefreshevent', args);
and controller this:
$scope.$on('myrefreshevent', function (args) { //handle refresh });
Comments
Post a Comment