{"action":"created","issue":{"url":"https://api.github.com/repos/angular/angular.js/issues/14158","repository_url":"https://api.github.com/repos/angular/angular.js","labels_url":"https://api.github.com/repos/angular/angular.js/issues/14158/labels{/name}","comments_url":"https://api.github.com/repos/angular/angular.js/issues/14158/comments","events_url":"https://api.github.com/repos/angular/angular.js/issues/14158/events","html_url":"https://github.com/angular/angular.js/issues/14158","id":137670884,"number":14158,"title":"Angular-mock.js 1.5 is triggering scope.$destroy","user":{"login":"aarongan","id":2922622,"avatar_url":"https://avatars.githubusercontent.com/u/2922622?v=3","gravatar_id":"","url":"https://api.github.com/users/aarongan","html_url":"https://github.com/aarongan","followers_url":"https://api.github.com/users/aarongan/followers","following_url":"https://api.github.com/users/aarongan/following{/other_user}","gists_url":"https://api.github.com/users/aarongan/gists{/gist_id}","starred_url":"https://api.github.com/users/aarongan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aarongan/subscriptions","organizations_url":"https://api.github.com/users/aarongan/orgs","repos_url":"https://api.github.com/users/aarongan/repos","events_url":"https://api.github.com/users/aarongan/events{/privacy}","received_events_url":"https://api.github.com/users/aarongan/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/angular/angular.js/labels/component:%20ngMock","name":"component: ngMock","color":"bfd4f2"},{"url":"https://api.github.com/repos/angular/angular.js/labels/needs:%20more%20info","name":"needs: more info","color":"d7eb9f"},{"url":"https://api.github.com/repos/angular/angular.js/labels/severity:%20regression","name":"severity: regression","color":"e11d21"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/angular/angular.js/milestones/35","html_url":"https://github.com/angular/angular.js/milestones/Purgatory","labels_url":"https://api.github.com/repos/angular/angular.js/milestones/35/labels","id":526241,"number":35,"title":"Purgatory","description":"This milestone is for issues and PRs that weren't accepted yet and we are waiting for more info from the submitter.\r\n\r\nFor issues this typically means that we weren't able to reproduce the issue or we haven't decided yet if a feature request is a good idea at all.\r\n\r\nFor PRs this means that the PR still needs a lot of work and we might not even be interested in merging it because it looks like a non-core feature. We are still waiting for more discussion within the team or more info from the contributor before making the final decision.","creator":{"login":"IgorMinar","id":216296,"avatar_url":"https://avatars.githubusercontent.com/u/216296?v=3","gravatar_id":"","url":"https://api.github.com/users/IgorMinar","html_url":"https://github.com/IgorMinar","followers_url":"https://api.github.com/users/IgorMinar/followers","following_url":"https://api.github.com/users/IgorMinar/following{/other_user}","gists_url":"https://api.github.com/users/IgorMinar/gists{/gist_id}","starred_url":"https://api.github.com/users/IgorMinar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/IgorMinar/subscriptions","organizations_url":"https://api.github.com/users/IgorMinar/orgs","repos_url":"https://api.github.com/users/IgorMinar/repos","events_url":"https://api.github.com/users/IgorMinar/events{/privacy}","received_events_url":"https://api.github.com/users/IgorMinar/received_events","type":"User","site_admin":false},"open_issues":122,"closed_issues":653,"state":"open","created_at":"2014-01-04T01:20:50Z","updated_at":"2016-03-10T15:15:49Z","due_on":null,"closed_at":null},"comments":6,"created_at":"2016-03-01T19:55:49Z","updated_at":"2016-03-10T15:31:40Z","closed_at":null,"body":"hi Angular Team, \r\n\r\nI have a problem when migrating from Angular 1.4.3 to 1.5. We are facing angular-mock issue which is triggering scope.$destroy when compile a template and digest/apply. So basically i have callback function in scope.$destroy and it get removed before my unit test.\r\n\r\nAnd if i use Angular-mock.js from 1.4.3 it works fine. Please advise. \r\nBelow are code that trigger the $destroy, which both 1.4.3 and 1.5 has same code but 1.4.3 doesn't trigger scope.$destroy. \r\n\r\nThank you \r\n\r\n```js\r\nif (injector) {\r\n  injector.get('$rootElement').off();\r\n  injector.get('$rootScope').$destroy();   --> this is triggering my directive scope.$destroy\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/angular/angular.js/issues/comments/194906022","html_url":"https://github.com/angular/angular.js/issues/14158#issuecomment-194906022","issue_url":"https://api.github.com/repos/angular/angular.js/issues/14158","id":194906022,"user":{"login":"gkalpak","id":8604205,"avatar_url":"https://avatars.githubusercontent.com/u/8604205?v=3","gravatar_id":"","url":"https://api.github.com/users/gkalpak","html_url":"https://github.com/gkalpak","followers_url":"https://api.github.com/users/gkalpak/followers","following_url":"https://api.github.com/users/gkalpak/following{/other_user}","gists_url":"https://api.github.com/users/gkalpak/gists{/gist_id}","starred_url":"https://api.github.com/users/gkalpak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gkalpak/subscriptions","organizations_url":"https://api.github.com/users/gkalpak/orgs","repos_url":"https://api.github.com/users/gkalpak/repos","events_url":"https://api.github.com/users/gkalpak/events{/privacy}","received_events_url":"https://api.github.com/users/gkalpak/received_events","type":"User","site_admin":false},"created_at":"2016-03-10T15:31:39Z","updated_at":"2016-03-10T15:31:39Z","body":"This is an indeication that your tests somehow rely on the scope not being destroyed after the test.\r\nAre you using a scope from a previous testcase ?\r\n\r\nCan you post the tests that cause this error ? Can you isolate them ?"}}