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.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *