July 2017
Intermediate to advanced
454 pages
10h 1m
English
For the second child component, we used a technique based on injecting components via this property declaration from the app.component.ts file:
@ViewChildren(ChildComponent) childComponents: QueryList<ChildComponent>;
The ViewChildren decorator takes a selector for the ChildComponent type that will identify and collect all the ChildComponent instances from the parent component template into a specialized list of the QueryList type. This list allows iterating through the child component instances, and we can get a reference for the second child component using the QueryList.Last() call in the AppComponent. setSecondChildComponentProperties() method. When running the code found in the Example4 folder for the source ...
Read now
Unlock full access