3 Ways to Pass Async Data to Angular 2+ Child Components ― Scotch.io

Let’s start with a common use case. You have some data you get from external source (e.g. by calling API). You want to display it on screen.However, instead of displaying it on the same component, you would like to pass the data to a child component to display.The child component might has some logic to pre-process the data before showing on screen.

Solution 1: Use *ngIf
Solution 2: Use ngOnChanges
Solution 3: Use RxJs BehaviorSubject

Source: 3 Ways to Pass Async Data to Angular 2+ Child Components ― Scotch.io

Leave a Reply

Your email address will not be published. Required fields are marked *