{"action":"opened","issue":{"url":"https://api.github.com/repos/angular/angular/issues/1335","labels_url":"https://api.github.com/repos/angular/angular/issues/1335/labels{/name}","comments_url":"https://api.github.com/repos/angular/angular/issues/1335/comments","events_url":"https://api.github.com/repos/angular/angular/issues/1335/events","html_url":"https://github.com/angular/angular/issues/1335","id":68157729,"number":1335,"title":"deregister $on handlers on $destroy","user":{"login":"secrettriangle","id":1765130,"avatar_url":"https://avatars.githubusercontent.com/u/1765130?v=3","gravatar_id":"","url":"https://api.github.com/users/secrettriangle","html_url":"https://github.com/secrettriangle","followers_url":"https://api.github.com/users/secrettriangle/followers","following_url":"https://api.github.com/users/secrettriangle/following{/other_user}","gists_url":"https://api.github.com/users/secrettriangle/gists{/gist_id}","starred_url":"https://api.github.com/users/secrettriangle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/secrettriangle/subscriptions","organizations_url":"https://api.github.com/users/secrettriangle/orgs","repos_url":"https://api.github.com/users/secrettriangle/repos","events_url":"https://api.github.com/users/secrettriangle/events{/privacy}","received_events_url":"https://api.github.com/users/secrettriangle/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-04-13T18:01:30Z","updated_at":"2015-04-13T18:01:30Z","closed_at":null,"body":"If an event handler is registered like so:\r\n```js\r\n$scope.$on('evt', function () {/* */});\r\n```\r\n\r\nAngular should add the handler to an array internally and deregister it when the scope is destroyed:\r\n```js\r\n$scope.$on('$destroy', function () {\r\n    deregisterFns.forEach(function (deregister) { deregister(); });\r\n});\r\n```"}}