2016-04-29 00:50:03 +00:00
|
|
|
import {Type} from '@angular/core';
|
2015-11-05 22:58:24 +00:00
|
|
|
import {FORM_DIRECTIVES} from './forms';
|
|
|
|
|
import {CORE_DIRECTIVES} from './directives';
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* A collection of Angular core directives that are likely to be used in each and every Angular
|
|
|
|
|
* application. This includes core directives (e.g., NgIf and NgFor), and forms directives (e.g.,
|
|
|
|
|
* NgModel).
|
|
|
|
|
*
|
|
|
|
|
* This collection can be used to quickly enumerate all the built-in directives in the `directives`
|
2016-03-08 21:36:48 +00:00
|
|
|
* property of the `@Component` decorator.
|
2015-11-05 22:58:24 +00:00
|
|
|
*
|
|
|
|
|
* ### Example
|
|
|
|
|
*
|
|
|
|
|
* Instead of writing:
|
|
|
|
|
*
|
|
|
|
|
* ```typescript
|
|
|
|
|
* import {NgClass, NgIf, NgFor, NgSwitch, NgSwitchWhen, NgSwitchDefault, NgModel, NgForm} from
|
2016-04-29 00:50:03 +00:00
|
|
|
* '@angular/common';
|
2015-11-05 22:58:24 +00:00
|
|
|
* import {OtherDirective} from './myDirectives';
|
|
|
|
|
*
|
|
|
|
|
* @Component({
|
|
|
|
|
* selector: 'my-component',
|
|
|
|
|
* templateUrl: 'myComponent.html',
|
|
|
|
|
* directives: [NgClass, NgIf, NgFor, NgSwitch, NgSwitchWhen, NgSwitchDefault, NgModel, NgForm,
|
|
|
|
|
* OtherDirective]
|
|
|
|
|
* })
|
|
|
|
|
* export class MyComponent {
|
|
|
|
|
* ...
|
|
|
|
|
* }
|
|
|
|
|
* ```
|
|
|
|
|
* one could import all the common directives at once:
|
|
|
|
|
*
|
|
|
|
|
* ```typescript
|
2016-04-29 00:50:03 +00:00
|
|
|
* import {COMMON_DIRECTIVES} from '@angular/common';
|
2015-11-05 22:58:24 +00:00
|
|
|
* import {OtherDirective} from './myDirectives';
|
|
|
|
|
*
|
|
|
|
|
* @Component({
|
|
|
|
|
* selector: 'my-component',
|
|
|
|
|
* templateUrl: 'myComponent.html',
|
|
|
|
|
* directives: [COMMON_DIRECTIVES, OtherDirective]
|
|
|
|
|
* })
|
|
|
|
|
* export class MyComponent {
|
|
|
|
|
* ...
|
|
|
|
|
* }
|
|
|
|
|
* ```
|
2016-05-27 18:24:05 +00:00
|
|
|
*
|
|
|
|
|
* @experimental Contains forms which are experimental.
|
2015-11-05 22:58:24 +00:00
|
|
|
*/
|
2016-04-26 04:47:33 +00:00
|
|
|
export const COMMON_DIRECTIVES: Type[][] = /*@ts2dart_const*/[CORE_DIRECTIVES, FORM_DIRECTIVES];
|