Open hjzheng opened 8 years ago
7:3 error The "$watch" call should be assigned to a variable, in order to be destroyed during the $destroy event angular/on-watch
(function() { angular.module('app').run(run); run.$inject = ['$rootScope', '$location', '$http']; function run($rootScope, $location, $http) { var callback = $rootScope.$watch(function() { return $location.search(); }, function(newValue) { if (newValue.token) { $http.defaults.headers.common.token = newValue.token; } }); $rootScope.$on('$destroy', callback); } })();
7:3 error The "$watch" call should be assigned to a variable, in order to be destroyed during the $destroy event angular/on-watch