Question 1 of 82
What is the purpose of the ViewChild decorator in this component class?
@Component({ ... template: '<p #bio></p>' }) export class UserDetailsComponent { @ViewChild('bio') bio; }
It provides access from within the component class to the ElementRef object for the <p> tag that has the bio template reference variable in the component's template view.
<p>
It indicates that the <p> tag be rendered as a child of the parent view that uses this component.
It makes the <p> tag in the template support content projection.
It makes the <p> tag visible in the final render. If the #bio was used in the template and the @ViewChild was not used in the class, then Angular would automatically hide the <p> tag that has #bio on it.
DigitalOcean - viewchild-access-component
Time Remaining:01:30
Questions: 1/82