-
Notifications
You must be signed in to change notification settings - Fork 26.5k
Closed
Labels
area: coreIssues related to the framework runtimeIssues related to the framework runtimecore: inputs / outputscross-cutting: observablesfeatureIssue that requests a new featureIssue that requests a new featurefeature: under considerationFeature request for which voting has completed and the request is now under considerationFeature request for which voting has completed and the request is now under considerationstate: Needs Design
Milestone
Description
Sorry, I'm not good at English.
@Input
property values are provided by parent component. The changes come asynchronously.
And if Input property was changed in the child component (it has the property as own property) , its change detector never notice it.
Goal
- Parent's input data and child's input property should be synchronized.
- Developers should understand that input properties are changed asynchronously.
Proposal
@Component({ selector: "child" })
class Child {
@Input("input") inputValue: Observable<T>;
ngOnInit() {
this.inputValue.map((value)=>...);
}
}
@Component({
template: `
<child [input]="valueToChild"></child>
`
})
class Parent {
valueToChild: T;
}
Above code does not work. Currently, to receive input as Observable<T>
, I must write it like below.
@Component({ selector: "child" })
class Child {
@Input("input") inputValue: Observable<T>
}
@Component({
template: `
<child [input]="valueToChild"></child>
`
})
class Parent {
valueToChild: Observable<T> = new Observable<T>((observer)=>{
...
observer.next(val);
});
}
Example: http://plnkr.co/edit/BWziQygApOezTENdTVp1?p=preview
This works well, but it's not essential. Parent's input data is a simple data originally.
I think this proposal make us happy.
Thanks.
fxck, demisx, jshthornton, nosachamos, joshwiens and 251 morefxck, e7h4n, hotspurs, alexw10, maxime1992 and 26 moreskubekk, QuinntyneBrown, lianyi, kuhnroyal, hotspurs and 33 morebrq-cr, asmolcic, AwesomeObserver, kashesandr, DmRk-Vl and 10 more
Metadata
Metadata
Assignees
Labels
area: coreIssues related to the framework runtimeIssues related to the framework runtimecore: inputs / outputscross-cutting: observablesfeatureIssue that requests a new featureIssue that requests a new featurefeature: under considerationFeature request for which voting has completed and the request is now under considerationFeature request for which voting has completed and the request is now under considerationstate: Needs Design