本文整理汇总了TypeScript中angular2/src/core/util/decorators.makeDecorator函数的典型用法代码示例。如果您正苦于以下问题:TypeScript makeDecorator函数的具体用法?TypeScript makeDecorator怎么用?TypeScript makeDecorator使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了makeDecorator函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: makeDecorator
/**
* Defines route lifecycle hook `CanActivate`, which is called by the router to determine
* if a component can be instantiated as part of a navigation.
*
* <aside class="is-right">
* Note that unlike other lifecycle hooks, this one uses an annotation rather than an interface.
* This is because the `CanActivate` function is called before the component is instantiated.
* </aside>
*
* The `CanActivate` hook is called with two {@link ComponentInstruction}s as parameters, the first
* representing the current route being navigated to, and the second parameter representing the
* previous route or `null`.
*
* ```typescript
* @CanActivate((next, prev) => boolean | Promise<boolean>)
* ```
*
* If `CanActivate` returns or resolves to `false`, the navigation is cancelled.
* If `CanActivate` throws or rejects, the navigation is also cancelled.
* If `CanActivate` returns or resolves to `true`, navigation continues, the component is
* instantiated, and the {@link OnActivate} hook of that component is called if implemented.
*
* ### Example
*
* {@example router/ts/can_activate/can_activate_example.ts region='canActivate' }
*/
export var CanActivate: (hook: (next: ComponentInstruction, prev: ComponentInstruction) =>
Promise<boolean>| boolean) => ClassDecorator =
makeDecorator(CanActivateAnnotation);
开发者ID:1186792881,项目名称:angular,代码行数:29,代码来源:lifecycle_annotations.ts
示例2: constructor
export class ClassDecoratorMeta {
constructor(public value) {}
}
export class ParamDecoratorMeta {
constructor(public value) {}
}
export class PropDecoratorMeta {
constructor(public value) {}
}
export function classDecorator(value) {
return new ClassDecoratorMeta(value);
}
export function paramDecorator(value) {
return new ParamDecoratorMeta(value);
}
export function propDecorator(value) {
return new PropDecoratorMeta(value);
}
export var ClassDecorator = makeDecorator(ClassDecoratorMeta);
export var ParamDecorator = makeParamDecorator(ParamDecoratorMeta);
export var PropDecorator = makePropDecorator(PropDecoratorMeta);
// used only in Dart
export class HasGetterAndSetterDecorators {}
开发者ID:LordBinary,项目名称:angular,代码行数:30,代码来源:reflector_common.ts
示例3: makeDecorator
import {RendererConfig as RendererConfigAnnotation,RendererDefinition} from './renderer_config_impl';
import {makeDecorator} from 'angular2/src/core/util/decorators';
import {Type} from 'angular2/src/facade/lang';
// Copied from RouteConfig in renderer_config_impl.
/**
* The `RendererConfig` decorator defines renderers for a given component.
*
* It takes an array of {@link RendererDefinition}s.
*/
export var RendererConfig: (configs: RendererDefinition[]) => ClassDecorator =
makeDecorator(RendererConfigAnnotation);
开发者ID:namax,项目名称:jsonforms_angular2,代码行数:12,代码来源:renderer_config_decorator.ts
示例4: makeDecorator
import {RouteConfig as RouteConfigAnnotation, RouteDefinition} from './route_config_impl';
import {makeDecorator} from 'angular2/src/core/util/decorators';
export {Route, Redirect, AuxRoute, AsyncRoute, RouteDefinition} from './route_config_impl';
export var RouteConfig: (configs: RouteDefinition[]) => ClassDecorator =
makeDecorator(RouteConfigAnnotation);
开发者ID:MingXingTeam,项目名称:awesome-front-end,代码行数:6,代码来源:route_config_decorator.ts
示例5: makeDecorator
import {UISchemaProviderConfig as UISchemaProviderConfigAnnotation,UISchemaProvider} from './uischema_config_impl';
import {makeDecorator} from 'angular2/src/core/util/decorators';
import {Type} from 'angular2/src/facade/lang';
// Copied from RouteConfig in renderer_config_impl.
/**
* The `RendererConfig` decorator defines renderers for a given component.
*
* It takes an array of {@link RendererDefinition}s.
*/
export var UISchemaProviderConfig: (configs: UISchemaProvider[]) => ClassDecorator =
makeDecorator(UISchemaProviderConfigAnnotation);
开发者ID:namax,项目名称:jsonforms_angular2,代码行数:12,代码来源:uischema_config_decorator.ts
注:本文中的angular2/src/core/util/decorators.makeDecorator函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论