Sitelet https://web.archive.org/web/20240920155512/https://angular.dev/api/common/NgSwitch/
@angular/common

NgSwitch

directive

The [ngSwitch] directive on a container specifies an expression to match against. The expressions to match are provided by ngSwitchCase directives on views within the container.

  • Every view that matches is rendered.
  • If there are no matches, a view with the ngSwitchDefault directive is rendered.
  • Elements within the [NgSwitch] statement but outside of any NgSwitchCase or ngSwitchDefault directive are preserved at the location.
  
    class NgSwitch {}
  
  
Jump to details