当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript decorators.makeDecorator函数代码示例

本文整理汇总了TypeScript中angular2/src/util/decorators.makeDecorator函数的典型用法代码示例。如果您正苦于以下问题:TypeScript makeDecorator函数的具体用法?TypeScript makeDecorator怎么用?TypeScript makeDecorator使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了makeDecorator函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: makeDecorator

import {RouteConfig as RouteConfigAnnotation, RouteDefinition} from './route_config_impl';
import {makeDecorator} from 'angular2/src/util/decorators';
import {List} from 'angular2/src/facade/collection';

export {
  Route,
  Redirect,
  AuxRoute,
  AsyncRoute,
  RouteDefinition,
  ROUTE_DATA
} from './route_config_impl';
export var RouteConfig: (configs: List<RouteDefinition>) => ClassDecorator =
    makeDecorator(RouteConfigAnnotation);
开发者ID:lavinjj,项目名称:angular,代码行数:14,代码来源:route_config_decorator.ts

示例2: makeDecorator

import {RouteConfig as RouteConfigAnnotation} from './route_config_impl';
import {makeDecorator} from 'angular2/src/util/decorators';

export var RouteConfig = makeDecorator(RouteConfigAnnotation);
开发者ID:AsherBarak,项目名称:angular,代码行数:4,代码来源:route_config_decorator.ts

示例3: makeDecorator

  onActivate,
  onReuse,
  onDeactivate
} from './lifecycle_annotations_impl';

/**
 * Defines route lifecycle method [canActivate], which is called by the router to determine
 * if a component can be instantiated as part of a navigation.
 *
 * Note that unlike other lifecycle hooks, this one uses an annotation rather than an interface.
 * This is because [canActivate] is called before the component is instantiated.
 *
 * If `canActivate` returns or resolves to `false`, the navigation is cancelled.
 *
 * If `canActivate` throws or rejects, the navigation is also cancelled.
 *
 * ## Example
 * ```
 * @Directive({
 *   selector: 'control-panel-cmp'
 * })
 * @CanActivate(() => checkIfUserIsLoggedIn())
 * class ControlPanelCmp {
 *   // ...
 * }
 *  ```
 */
export var CanActivate:
    (hook: (next: ComponentInstruction, prev: ComponentInstruction) => Promise<boolean>| boolean) =>
        ClassDecorator = makeDecorator(CanActivateAnnotation);
开发者ID:KenWilliamson,项目名称:Angular2HostedMobileApp,代码行数:30,代码来源:lifecycle_annotations.ts


注:本文中的angular2/src/util/decorators.makeDecorator函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。