CORE_DIRECTIVES top-level constant

const CORE_DIRECTIVES = const [NgClass, NgFor, NgIf, NgTemplateOutlet, NgStyle, NgSwitch, NgSwitchWhen, NgSwitchDefault]

A collection of Angular core directives that are likely to be used in each and every Angular application.

This collection can be used to quickly enumerate all the built-in directives in the directives property of the @Component annotation.

Example

Instead of writing:

import 'package:angular/common.dart'
show
NgClass,
NgIf,
NgFor,
NgSwitch,
NgSwitchWhen,
NgSwitchDefault;
import 'my_directives.dart' show OtherDirective;

@Component(
selector: 'my-component',
templateUrl: 'my_component.html',
directives: const [
NgClass,
NgIf,
NgFor,
NgSwitch,
NgSwitchWhen,
NgSwitchDefault,
OtherDirective
])
class MyComponent {
...
}

One could import all the core directives at once:

import 'angular/common.dart' show CORE_DIRECTIVES;
import 'my_directives.dart' show OtherDirective;

@Component(
selector: 'my-component',
templateUrl: 'my_component.html',
directives: const [CORE_DIRECTIVES, OtherDirective])
class MyComponent {
...
}

Implementation

const List<Type> CORE_DIRECTIVES = const [
  NgClass,
  NgFor,
  NgIf,
  NgTemplateOutlet,
  NgStyle,
  NgSwitch,
  NgSwitchWhen,
  NgSwitchDefault,
]