33 lines
4.2 KiB
JavaScript
33 lines
4.2 KiB
JavaScript
import { TEMPLATE_TRANSFORMS } from 'angular2/compiler';
|
|
import { Provider } from 'angular2/core';
|
|
import { RouterLinkTransform } from 'angular2/src/router/directives/router_link_transform';
|
|
import { CONST_EXPR } from 'angular2/src/facade/lang';
|
|
export { RouterLinkTransform } from 'angular2/src/router/directives/router_link_transform';
|
|
/**
|
|
* Enables the router link DSL.
|
|
*
|
|
* Warning. This feature is experimental and can change.
|
|
*
|
|
* To enable the transformer pass the router link DSL provider to `bootstrap`.
|
|
*
|
|
* ## Example:
|
|
* ```
|
|
* import {bootstrap} from 'angular2/platform/browser';
|
|
* import {ROUTER_LINK_DSL_PROVIDER} from 'angular2/router/router_link_dsl';
|
|
*
|
|
* bootstrap(CustomApp, [ROUTER_LINK_DSL_PROVIDER]);
|
|
* ```
|
|
*
|
|
* The DSL allows you to express router links as follows:
|
|
* ```
|
|
* <a [routerLink]="route:User"> <!-- Same as <a [routerLink]="['User']"> -->
|
|
* <a [routerLink]="route:/User"> <!-- Same as <a [routerLink]="['User']"> -->
|
|
* <a [routerLink]="route:./User"> <!-- Same as <a [routerLink]="['./User']"> -->
|
|
* <a [routerLink]="./User(id: value, name: 'Bob')"> <!-- Same as <a [routerLink]="['./User', {id:
|
|
* value, name: 'Bob'}]"> -->
|
|
* <a [routerLink]="/User/Modal"> <!-- Same as <a [routerLink]="['/User', 'Modal']"> -->
|
|
* <a [routerLink]="User[Modal]"> <!-- Same as <a [routerLink]="['User', ['Modal']]"> -->
|
|
* ```
|
|
*/
|
|
export const ROUTER_LINK_DSL_PROVIDER = CONST_EXPR(new Provider(TEMPLATE_TRANSFORMS, { useClass: RouterLinkTransform, multi: true }));
|
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicm91dGVyX2xpbmtfZHNsLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiYW5ndWxhcjIvcm91dGVyL3JvdXRlcl9sa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