{"action":"created","issue":{"url":"https://api.github.com/repos/angular/angular/issues/5689","labels_url":"https://api.github.com/repos/angular/angular/issues/5689/labels{/name}","comments_url":"https://api.github.com/repos/angular/angular/issues/5689/comments","events_url":"https://api.github.com/repos/angular/angular/issues/5689/events","html_url":"https://github.com/angular/angular/issues/5689","id":120916636,"number":5689,"title":"Proposal: Input as Observable","user":{"login":"laco0416","id":1529180,"avatar_url":"https://avatars.githubusercontent.com/u/1529180?v=3","gravatar_id":"","url":"https://api.github.com/users/laco0416","html_url":"https://github.com/laco0416","followers_url":"https://api.github.com/users/laco0416/followers","following_url":"https://api.github.com/users/laco0416/following{/other_user}","gists_url":"https://api.github.com/users/laco0416/gists{/gist_id}","starred_url":"https://api.github.com/users/laco0416/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/laco0416/subscriptions","organizations_url":"https://api.github.com/users/laco0416/orgs","repos_url":"https://api.github.com/users/laco0416/repos","events_url":"https://api.github.com/users/laco0416/events{/privacy}","received_events_url":"https://api.github.com/users/laco0416/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/angular/angular/labels/P4:%20nice%20to%20have","name":"P4: nice to have","color":"fef2c0"},{"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:%20RFC%20/%20discussion%20/%20question","name":"type: RFC / discussion / question","color":"EEEEEE"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-12-08T02:32:29Z","updated_at":"2015-12-08T07:52:30Z","closed_at":null,"body":"Sorry, I'm not good at English.\r\n\r\n`@Input` property values are provided by parent component. The changes come asynchronously.\r\nAnd if Input property was changed in the child component (it has the property as own property) , its change detector never notice it.\r\n\r\n## Goal \r\n\r\n* Parent's input data and child's input property should be synchronized.\r\n* Developers should understand that input properties are changed asynchronously.\r\n\r\n## Proposal\r\n\r\n```js\r\n@Component({ selector: \"child\" })\r\nclass Child {\r\n  @Input(\"input\") inputValue: Observable<T>;\r\n\r\n  ngOnInit() {\r\n    this.inputValue.map((value)=>...);\r\n  }\r\n}\r\n\r\n@Component({\r\n  template: `\r\n  <child [input]=\"valueToChild\"></child>\r\n  `\r\n})\r\nclass Parent {\r\n  valueToChild: T;\r\n}\r\n```\r\n\r\nAbove code does not work. Currently, to receive input as `Observable<T>`, I must write it like below.\r\n\r\n```js\r\n@Component({ selector: \"child\" })\r\nclass Child {\r\n  @Input(\"input\") inputValue: Observable<T>\r\n}\r\n\r\n@Component({\r\n  template: `\r\n  <child [input]=\"valueToChild\"></child>\r\n  `\r\n})\r\nclass Parent {\r\n  valueToChild: Observable<T> = new Observable<T>((observer)=>{\r\n    ...\r\n    observer.next(val);\r\n  });\r\n}\r\n```\r\n\r\nExample: http://plnkr.co/edit/BWziQygApOezTENdTVp1?p=preview\r\n\r\nThis works well, but it's not essential. Parent's input data is a simple data originally.\r\n\r\nI think this proposal make us happy. \r\n\r\nThanks.\r\n"},"comment":{"url":"https://api.github.com/repos/angular/angular/issues/comments/162804176","html_url":"https://github.com/angular/angular/issues/5689#issuecomment-162804176","issue_url":"https://api.github.com/repos/angular/angular/issues/5689","id":162804176,"user":{"login":"robwormald","id":534930,"avatar_url":"https://avatars.githubusercontent.com/u/534930?v=3","gravatar_id":"","url":"https://api.github.com/users/robwormald","html_url":"https://github.com/robwormald","followers_url":"https://api.github.com/users/robwormald/followers","following_url":"https://api.github.com/users/robwormald/following{/other_user}","gists_url":"https://api.github.com/users/robwormald/gists{/gist_id}","starred_url":"https://api.github.com/users/robwormald/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robwormald/subscriptions","organizations_url":"https://api.github.com/users/robwormald/orgs","repos_url":"https://api.github.com/users/robwormald/repos","events_url":"https://api.github.com/users/robwormald/events{/privacy}","received_events_url":"https://api.github.com/users/robwormald/received_events","type":"User","site_admin":false},"created_at":"2015-12-08T07:52:30Z","updated_at":"2015-12-08T07:52:30Z","body":"@alexpods i believe the idea here is exactly that - its *listening* to the change in input properties *as* an Observable, not emitting values upstream, which is absolutely fine as far as I'm concerned. "}}