{"action":"created","issue":{"url":"https://api.github.com/repos/angular/angular/issues/795","labels_url":"https://api.github.com/repos/angular/angular/issues/795/labels{/name}","comments_url":"https://api.github.com/repos/angular/angular/issues/795/comments","events_url":"https://api.github.com/repos/angular/angular/issues/795/events","html_url":"https://github.com/angular/angular/issues/795","id":58979796,"number":795,"title":"Allow directive to guard ChangedDetection","user":{"login":"mhevery","id":111951,"avatar_url":"https://avatars.githubusercontent.com/u/111951?v=3","gravatar_id":"","url":"https://api.github.com/users/mhevery","html_url":"https://github.com/mhevery","followers_url":"https://api.github.com/users/mhevery/followers","following_url":"https://api.github.com/users/mhevery/following{/other_user}","gists_url":"https://api.github.com/users/mhevery/gists{/gist_id}","starred_url":"https://api.github.com/users/mhevery/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mhevery/subscriptions","organizations_url":"https://api.github.com/users/mhevery/orgs","repos_url":"https://api.github.com/users/mhevery/repos","events_url":"https://api.github.com/users/mhevery/events{/privacy}","received_events_url":"https://api.github.com/users/mhevery/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/angular/angular/labels/comp:%20core/change_detection","name":"comp: core/change_detection","color":"c7def8"},{"url":"https://api.github.com/repos/angular/angular/labels/effort1:%20easy%20(hour)","name":"effort1: easy (hour)","color":"bfe5bf"},{"url":"https://api.github.com/repos/angular/angular/labels/P3:%20important","name":"P3: important","color":"fef2c0"},{"url":"https://api.github.com/repos/angular/angular/labels/state:%20Follow%20Up","name":"state: Follow Up","color":"006b75"},{"url":"https://api.github.com/repos/angular/angular/labels/state:%20Needs%20Design","name":"state: Needs Design","color":"006b75"},{"url":"https://api.github.com/repos/angular/angular/labels/type:%20feature","name":"type: feature","color":"EEEEEE"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-02-25T22:22:09Z","updated_at":"2015-08-25T05:00:59Z","closed_at":null,"body":"Any directive should be able to disable change detection below it (light DOM), if it knows that the current view is not visible. This needs to be annotation level information so that the HTML compiler can generate additional `ChangeDetection` class for the current view. The presence of the `ChangeDetectionControl` type in the injection will let the compiler know that we have to have artificial change detection boundary for the child elements.\r\n\r\n```\r\n@Decorator({\r\n  selector: 'pane',\r\n  bind: {\r\n    'selected': 'selected'\r\n  }\r\n})\r\nclass Pane interface  {\r\n  cdc:ChangedDetectionControl;\r\n  constructor(cdc: ChangeDetectionControl) {\r\n    this.cdc = cdc;\r\n  }\r\n\r\n  set selected(value) {\r\n    this.cdc.enable(value);\r\n  }\r\n}\r\n```\r\n\r\nThis would allow for:\r\n```\r\n<pane [selected]=\"false\">\r\n   {{ supper expensive binding which will be disabled when pane not selected.}}\r\n</pane>\r\n```"},"comment":{"url":"https://api.github.com/repos/angular/angular/issues/comments/134474630","html_url":"https://github.com/angular/angular/issues/795#issuecomment-134474630","issue_url":"https://api.github.com/repos/angular/angular/issues/795","id":134474630,"user":{"login":"vsavkin","id":35996,"avatar_url":"https://avatars.githubusercontent.com/u/35996?v=3","gravatar_id":"","url":"https://api.github.com/users/vsavkin","html_url":"https://github.com/vsavkin","followers_url":"https://api.github.com/users/vsavkin/followers","following_url":"https://api.github.com/users/vsavkin/following{/other_user}","gists_url":"https://api.github.com/users/vsavkin/gists{/gist_id}","starred_url":"https://api.github.com/users/vsavkin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vsavkin/subscriptions","organizations_url":"https://api.github.com/users/vsavkin/orgs","repos_url":"https://api.github.com/users/vsavkin/repos","events_url":"https://api.github.com/users/vsavkin/events{/privacy}","received_events_url":"https://api.github.com/users/vsavkin/received_events","type":"User","site_admin":false},"created_at":"2015-08-25T05:00:59Z","updated_at":"2015-08-25T05:00:59Z","body":"Since we are paying a source-code size penalty for every change detector class, I am considering encoding this logic into a detector (sort of like a goto statement). Another option would be to have a lightweight class (e.g., SubDetector).\r\n\r\nThis is a non-trivial change that should take a few days (maybe a week) to implement. \r\n"}}