{"action":"created","issue":{"url":"https://api.github.com/repos/ngParty/ng-metadata/issues/143","repository_url":"https://api.github.com/repos/ngParty/ng-metadata","labels_url":"https://api.github.com/repos/ngParty/ng-metadata/issues/143/labels{/name}","comments_url":"https://api.github.com/repos/ngParty/ng-metadata/issues/143/comments","events_url":"https://api.github.com/repos/ngParty/ng-metadata/issues/143/events","html_url":"https://github.com/ngParty/ng-metadata/issues/143","id":176177044,"number":143,"title":"$destroy event on $element not firing causing leaks","user":{"login":"reppners","id":3855704,"avatar_url":"https://avatars.githubusercontent.com/u/3855704?v=3","gravatar_id":"","url":"https://api.github.com/users/reppners","html_url":"https://github.com/reppners","followers_url":"https://api.github.com/users/reppners/followers","following_url":"https://api.github.com/users/reppners/following{/other_user}","gists_url":"https://api.github.com/users/reppners/gists{/gist_id}","starred_url":"https://api.github.com/users/reppners/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reppners/subscriptions","organizations_url":"https://api.github.com/users/reppners/orgs","repos_url":"https://api.github.com/users/reppners/repos","events_url":"https://api.github.com/users/reppners/events{/privacy}","received_events_url":"https://api.github.com/users/reppners/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-09-10T12:22:55Z","updated_at":"2016-09-11T12:59:55Z","closed_at":null,"body":"The `$destroy`-event fired on `IAugmentedJQuery`(https://docs.angularjs.org/api/ng/function/angular.element#events) when they are removed from DOM is not fired when using ng-metadata. This leads to all sorts of leaks because logic that does cleanup e.g. unregistering $watches are not executed.\r\n\r\nhttps://embed.plnkr.co/wHLoWOJ3who4vmqLu0Bd/"},"comment":{"url":"https://api.github.com/repos/ngParty/ng-metadata/issues/comments/246179038","html_url":"https://github.com/ngParty/ng-metadata/issues/143#issuecomment-246179038","issue_url":"https://api.github.com/repos/ngParty/ng-metadata/issues/143","id":246179038,"user":{"login":"reppners","id":3855704,"avatar_url":"https://avatars.githubusercontent.com/u/3855704?v=3","gravatar_id":"","url":"https://api.github.com/users/reppners","html_url":"https://github.com/reppners","followers_url":"https://api.github.com/users/reppners/followers","following_url":"https://api.github.com/users/reppners/following{/other_user}","gists_url":"https://api.github.com/users/reppners/gists{/gist_id}","starred_url":"https://api.github.com/users/reppners/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reppners/subscriptions","organizations_url":"https://api.github.com/users/reppners/orgs","repos_url":"https://api.github.com/users/reppners/repos","events_url":"https://api.github.com/users/reppners/events{/privacy}","received_events_url":"https://api.github.com/users/reppners/received_events","type":"User","site_admin":false},"created_at":"2016-09-11T12:59:55Z","updated_at":"2016-09-11T12:59:55Z","body":"The `$rootScope.$watch` leak on ng-material originates from the `$mdTheming`-service. Every component that has some theming will register itself on the `$mdTheming`-service where a `$watch` is registered on the `$rootScope` when either the `md-theme-watch` directive is used on the element or when `$mdThemingProvider.alwaysWatchTheme(true);` is configured.\r\n\r\nhttps://github.com/angular/material/blob/v1.1.1/src/core/services/theming/theming.js#L578\r\n\r\nOur app relies on theming and there is also a solution in place for generating theme-css for custom components which replicates how ng-material is doing it internally.\r\n\r\nAny hint on how to approach a fix is appreciated."}}
{"actor":{"display_login":"reppners"}}