I am using yo:angular-fullstack generator to build my website. When a user registers to the site, it will send an activation email with a link. When a user clicks t
yo:angular-fullstack
module.controller("TestController", function($scope, $timeout) { var onTimeout = function() { // something }; var timer = $timeout(onTimeout, 1000); $scope.$on("$destroy", function() { if (timer) { $timeout.cancel(timer); } }); });
you can call it simply when scope is destroyed.