My parent component html contains this line to call a child component with a default value of maxPrice:
<app-filter-events [maxPrice]='_maxPrice'></app-filter-events>
The parent component is getting the maxPrice by calling an API before instantiating the child component, here is the code :
constructor(private _dataService: DataService) {
this._dataService.getEventsByCriteria(this._filterCriteria).subscribe(res => this._maxPrice = res);
}
The problem is that maxPrice is undefined in the child component. I guess that the problem come from the async call to the API but I have no idea to resolve it.
Thanks
EDIT : My problem is not to hide the child component if the maxPrice is undefined but to have the maxPrice setted before instantiating the child component.