Which decorator allows you to listen for events from the children of the current component?
- @HostListener()
- @Input()
- @Output()
- @ViewChild()
The @ViewChild() decorator in Angular allows you to listen for events and interact with the children of the current component. It is commonly used to access and manipulate child components, directives, or elements within the template. While @Input() and @Output() decorators are used for communication between parent and child components, and @HostListener() is used for listening to events on the host element, none of these directly provide access to children components.
Loading...
Related Quiz
- When using OnPush change detection strategy, what can cause a component to be checked, besides changes to its input properties?
- For a form control in reactive forms, the property that holds the latest validation errors is called ______.
- If a parent component needs to send data to a child component, which property decorator should be used?
- When defining auxiliary routes in Angular, the route paths are prefixed with ________.
- To update your Angular CLI globally to the latest version, you would use the command npm install -g ________.