Created
March 7, 2014 14:09
-
-
Save dsdstudio/9412153 to your computer and use it in GitHub Desktop.
앵귤러쓸때 watcher 들을 꼭 정리하자~
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var watchers = []; | |
watchers.push($scope.$watch("currentTab", function(newer, older) { | |
$scope.routing = getRouting(newer); | |
})); | |
watchers.push($rootScope.$watch("SR.connected", function(connected) { | |
if ( connected ) $scope.watchAskingPriceWithMarketPrice(); | |
}, true)); | |
$scope.$on("$destroy", function(){ | |
watchers.forEach(function(fn) { fn(); }); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment