What is the primary use of the @Input() decorator in a component?
- To declare a component
- To declare a service
- To declare a variable
- To declare an Angular module
The primary use of the @Input() decorator in a component is to declare a variable as an input property. This allows data to be passed into the component from its parent component. Input properties enable communication between components, making it possible to send data from a parent component to a child component. It is not used to declare services, components, or Angular modules.
Loading...
Related Quiz
- In template-driven forms, which directive is used to conditionally apply CSS classes based on control validity?
- To capture changes in the @Input() property, one should implement the ______ interface.
- For guards that determine whether a module should be loaded or not, the method ______ should return a boolean or an observable that resolves to a boolean.
- What's the primary difference between structural and attribute directives in Angular?
- To make a service available only within a specific module, set the providedIn property to the ________ of that module.