Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Angular Directive Overview

Angular provides several built-in directives, such as:

  1. ngIf: Used to conditionally render a block of content based on a boolean expression.
  2. ngFor: Used to iterate over a collection of data and generate a block of content for each item in the collection.
  3. ngSwitch: Used to conditionally render a block of content based on a value.
  4. ngStyle: Used to dynamically set CSS styles on an element based on a given expression.
  5. ngClass: Used to dynamically set CSS classes on an element based on a given expression.
  6. ngModel: Used to two-way bind an input, select, or textarea element to a property on the component.
  7. ngSubmit: Used to bind a form submission event to a method on the component.
  8. ngTemplateOutlet: Used to render a template dynamically based on a given context.

These directives can be used to simplify the development of Angular applications and make them more dynamic and interactive. Additionally, you can create your own custom directives to extend the functionality of Angular.