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?

  • Attribute Directive
  • Component Directive
  • Service Directive
  • Structural Directive
When you need to modify the structure of the DOM based on user roles, a Structural Directive is the most appropriate choice. Structural Directives, such as ngIf and ngFor, can conditionally add or remove elements from the DOM, allowing you to customize the view based on user roles or conditions. This flexibility makes them well-suited for this scenario.
Add your answer
Loading...

Leave a comment

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