UNPKG

angular2

Version:

Angular 2 - a web framework for modern web apps

54 lines (51 loc) 1.5 kB
import {OpaqueToken} from "angular2/src/core/di"; import {CONST_EXPR} from "angular2/src/facade/lang"; /** * A token that can be provided when bootstraping an application to make an array of directives * available in every component of the application. * * ### Example * * ```typescript * import {PLATFORM_DIRECTIVES} from 'angular2/core'; * import {OtherDirective} from './myDirectives'; * * @Component({ * selector: 'my-component', * template: ` * <!-- can use other directive even though the component does not list it in `directives` --> * <other-directive></other-directive> * ` * }) * export class MyComponent { * ... * } * * bootstrap(MyComponent, [provide(PLATFORM_DIRECTIVES, {useValue: [OtherDirective], multi:true})]); * ``` */ export const PLATFORM_DIRECTIVES: OpaqueToken = CONST_EXPR(new OpaqueToken("Platform Directives")); /** * A token that can be provided when bootstraping an application to make an array of pipes * available in every component of the application. * * ### Example * * ```typescript * import {PLATFORM_PIPES} from 'angular2/core'; * import {OtherPipe} from './myPipe'; * * @Component({ * selector: 'my-component', * template: ` * {{123 | other-pipe}} * ` * }) * export class MyComponent { * ... * } * * bootstrap(MyComponent, [provide(PLATFORM_PIPES, {useValue: [OtherPipe], multi:true})]); * ``` */ export const PLATFORM_PIPES: OpaqueToken = CONST_EXPR(new OpaqueToken("Platform Pipes"));