Imagine you're building an Angular application that involves creating a directive to apply dynamic styling to elements. How can you pass values to your custom directive to make it reusable across different elements?
- Pass values through the DOM using attributes
- Use a service to share data between elements
- Use global variables to store values
- Use the @Input decorator to pass values as input properties
To make a directive reusable across different elements, you should use the @Input decorator to pass values as input properties.
Loading...
Related Quiz
- In NgRx, the _____ is responsible for changing the state based on the action received.
- How do you access a specific form control within a Form Array in Angular?
- To add a third-party library to an Angular project, you can use the _____ command of Angular CLI.
- What is the significance of the declarations array in an Angular module?
- In NgRx, the _____ property of an action usually contains additional information or context.