If a parent component needs to send data to a child component, which property decorator should be used?
- @ViewChild
- @Input
- @Output
- @ContentChild
To send data from a parent component to a child component in Angular, you should use the @Input property decorator. It allows the parent component to bind data to a property of the child component. The other options, such as @ViewChild, @Output, and @ContentChild, serve different purposes, like accessing child elements or emitting events.
Loading...
Related Quiz
- Your application requires a custom directive that modifies the structure of the DOM based on user roles. Which type of directive should you consider creating?
- A client asks for a feature where certain parts of the application should only be accessible to authenticated users. Which feature of Angular would you use to implement this?
- Imagine you have a modal component, and you want users to define custom header, body, and footer for each modal instance. How would you set up the modal component to achieve this?
- The routerLink directive can be bound to an array, allowing you to pass ________ to the route.
- Which of the following is NOT a method available on ViewContainerRef?