@ViewChildis a decorator function that takes the name of a component class as its input and finds its selector in the template of the containing component to bind to.
@ViewChildcan also be passed a template reference variable.
AlertComponentto its selector
<app-alert>and assign it to the property
alert. This allows us to gain access to class methods, like
@Input(). However, it might be a useful construct in keeping things generic.
@ViewChildren. It collects a list of instances of the Alert component, stored in a QueryList object that behaves similar to an array.
@ViewChildrena child component or a list of children component are selected respectively using their selector from the template. In addition both
@ViewChildrencan be passed a selector string:
ngAfterViewInitlifecycle hook is called.
@ContentChildrenwork the same way as the equivalent
@ViewChildren, however, the key difference is that
@ContentChildrenselect from the projected content within the component.
ngAfterContentInitcomponent lifecycle hook.