Reputation: 1701
In my Angular 2 app I have one main component that has a certain child component (named SystemDynamicsComponent in particular) embedded.
I include this child component in the parent component as follows:
<system-dynamics [sdFactors]="displayedCalculation?.getCombinedSdFactors()"></system-dynamics>
The interesting part is the parameter sdFactors
which is passed to the child component. Inside the child component it is defined as follows:
@Input() sdFactors: any[] = [];
Summarized, the parent component passes data to the child component like above.
The point is that the parent component obtains the data asynchronously over HTTP using a Promise. For some reason I want to inform the child component once this data is completely retrieved.
How to achieve this?
Upvotes: 0
Views: 269
Reputation: 796
You can add getter and setter for this :
private _sdFactors: any[] = [];
@Input()
public set sdFactor(value: any[]) {
// sdFactor updated ! you can do something
this._sdFactor = value;
}
public get sdFactor(): any[] {
return this._sdFactor;
}
Upvotes: 1