Skip to content

Instantly share code, notes, and snippets.

@hn5092
Created August 16, 2016 02:39
Show Gist options
  • Save hn5092/8365a85528dd6d25e0133ff36e677f41 to your computer and use it in GitHub Desktop.
Save hn5092/8365a85528dd6d25e0133ff36e677f41 to your computer and use it in GitHub Desktop.
angular watch
$rootScope.$watch('tmpChartCount', function (newValue, oldValue, isRefren) {
console.log("change");
if ($rootScope.tmpChartMap.count() > 0)
$rootScope.tmpChartMap.forEach(function (k, v) {
$http.get(v.url).then(function (response) {
v.data = response.data;
v.draw();
$rootScope.chartMap.set(k, v);
$rootScope.tmpChartMap.remove(k);
});
});
}, true);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment