I have a situation that i m passing a value from a father component to child component with @Input. The problem is that i dont get the value from father before ngOnInit() triggered in the child component. So what happens is that when ngOnInit() tries to do sg with the value its "undefined", and a second later the value filled but ngOnInit() already done. I hope it was clear enough.
Is there any way to kind of synchronice this two so, first i get the data than fill the elements ?
@Input('data')
set data(value) {
this._data = value;
this.noActivityData = (this._data === null || this._data === undefined);
}
ngOnInit() {
if(this._data){
elements.activeTimeDistribution.selected = !this.noActivityData;
elements.stepsDay.selected = !this.noActivityData;
elements.walkingSpeed.selected = !this.noActivityData;
elements.activeTimeDistribution.disabled = this.noActivityData;
elements.stepsDay.disabled = this.noActivityData;
elements.walkingSpeed.disabled = this.noActivityData;
}
});
}