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


TypeScript lang.CONST_EXPR函数代码示例

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


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

示例1: iterableChangesAsString

export function iterableChangesAsString({collection = CONST_EXPR([]), previous = CONST_EXPR([]),
                                         additions = CONST_EXPR([]), moves = CONST_EXPR([]),
                                         removals = CONST_EXPR([])}) {
  return "collection: " + collection.join(', ') + "\n" + "previous: " + previous.join(', ') + "\n" +
         "additions: " + additions.join(', ') + "\n" + "moves: " + moves.join(', ') + "\n" +
         "removals: " + removals.join(', ') + "\n";
}
开发者ID:hankduan,项目名称:angular,代码行数:7,代码来源:util.ts

示例2: makeLocation

 function makeLocation(baseHref: string = '/my/app', provider: any = CONST_EXPR([])): Location {
   locationStrategy = new MockLocationStrategy();
   locationStrategy.internalBaseHref = baseHref;
   let injector = Injector.resolveAndCreate(
       [Location, provide(LocationStrategy, {useValue: locationStrategy}), provider]);
   return location = injector.get(Location);
 }
开发者ID:hankduan,项目名称:angular,代码行数:7,代码来源:location_spec.ts

示例3: detectChanges

 function detectChanges(compiler: ChangeDetectionCompiler, template: string,
                        directives: CompileDirectiveMetadata[] = CONST_EXPR([])): string[] {
   var type =
       new CompileTypeMetadata({name: stringify(SomeComponent), moduleUrl: THIS_MODULE_URL});
   var parsedTemplate = parser.parse(template, directives, 'TestComp');
   var factories =
       compiler.compileComponentRuntime(type, ChangeDetectionStrategy.Default, parsedTemplate);
   return testChangeDetector(factories[0]);
 }
开发者ID:hankduan,项目名称:angular,代码行数:9,代码来源:change_detector_compiler_spec.ts

示例4: writeValue

import {CONST_EXPR} from 'angular2/src/core/facade/lang';
import {OpaqueToken} from 'angular2/src/core/di';

/**
 * A bridge between a control and a native element.
 *
 * Please see {@link DefaultValueAccessor} for more information.
 */
export interface ControlValueAccessor {
  writeValue(obj: any): void;
  registerOnChange(fn: any): void;
  registerOnTouched(fn: any): void;
}

export const NG_VALUE_ACCESSOR: OpaqueToken = CONST_EXPR(new OpaqueToken("NgValueAccessor"));
开发者ID:beta3000,项目名称:hola-angular2,代码行数:15,代码来源:control_value_accessor.ts

示例5: CONST_EXPR

 *
 * ### Example:
 *
 * ```typescript
 * @Component({
 *   selector: 'my-app',
 *   directives: [FORM_DIRECTIVES]
 * })
 * class MyApp {}
 * ```
 */
export const FORM_DIRECTIVES: Type[] = CONST_EXPR([
  NgControlName,
  NgControlGroup,

  NgFormControl,
  NgModel,
  NgFormModel,
  NgForm,

  NgSelectOption,
  DefaultValueAccessor,
  CheckboxControlValueAccessor,
  SelectControlValueAccessor,
  NgControlStatus,

  RequiredValidator,
  MinLengthValidator,
  MaxLengthValidator
]);
开发者ID:jianliao,项目名称:angular-upgrade-demo,代码行数:30,代码来源:directives.ts

示例6: CONST_EXPR

import {OpaqueToken, Binding} from 'angular2/src/core/di';
import {CONST_EXPR, Math, StringWrapper} from 'angular2/src/core/facade/lang';

/**
 *  @private
 */
export const APP_COMPONENT_REF_PROMISE = CONST_EXPR(new OpaqueToken('Promise<ComponentRef>'));

/**
 * An {@link angular2/di/OpaqueToken} representing the application root type in the {@link
 * Injector}.
 *
 * ```
 * @Component(...)
 * @View(...)
 * class MyApp {
 *   ...
 * }
 *
 * bootstrap(MyApp).then((appRef:ApplicationRef) {
 *   expect(appRef.injector.get(appComponentTypeToken)).toEqual(MyApp);
 * });
 *
 * ```
 */
export const APP_COMPONENT: OpaqueToken = CONST_EXPR(new OpaqueToken('AppComponent'));

/**
 * A DI Token representing a unique string id assigned to the application by Angular and used
 * primarily for prefixing application attributes and CSS styles when
 * {@link ViewEncapsulation#Emulated} is being used.
开发者ID:chiragjraval,项目名称:AdvisroySystemPOC,代码行数:31,代码来源:application_tokens.ts

示例7: CONST_EXPR

  DebugContext,
  ChangeDetectorGenConfig
} from './interfaces';
export {ChangeDetectionStrategy, CHANGE_DECTION_STRATEGY_VALUES} from './constants';
export {DynamicProtoChangeDetector} from './proto_change_detector';
export {JitProtoChangeDetector} from './jit_proto_change_detector';
export {BindingRecord, BindingTarget} from './binding_record';
export {DirectiveIndex, DirectiveRecord} from './directive_record';
export {DynamicChangeDetector} from './dynamic_change_detector';
export {ChangeDetectorRef} from './change_detector_ref';
export {IterableDiffers, IterableDiffer, IterableDifferFactory} from './differs/iterable_differs';
export {KeyValueDiffers, KeyValueDiffer, KeyValueDifferFactory} from './differs/keyvalue_differs';
export {PipeTransform, PipeOnDestroy} from './pipe_transform';
export {WrappedValue, SimpleChange} from './change_detection_util';

/**
 * Structural diffing for `Object`s and `Map`s.
 */
export const keyValDiff: KeyValueDifferFactory[] =
    CONST_EXPR([CONST_EXPR(new DefaultKeyValueDifferFactory())]);

/**
 * Structural diffing for `Iterable` types such as `Array`s.
 */
export const iterableDiff: IterableDifferFactory[] =
    CONST_EXPR([CONST_EXPR(new DefaultIterableDifferFactory())]);

export const defaultIterableDiffers = CONST_EXPR(new IterableDiffers(iterableDiff));

export const defaultKeyValueDiffers = CONST_EXPR(new KeyValueDiffers(keyValDiff));
开发者ID:beta3000,项目名称:hola-angular2,代码行数:30,代码来源:change_detection.ts

示例8: constructor

import {CONST, CONST_EXPR} from 'angular2/src/core/facade/lang';

@CONST()
export class RouteLifecycleHook {
  constructor(public name: string) {}
}

@CONST()
export class CanActivate {
  constructor(public fn: Function) {}
}

export const canReuse: RouteLifecycleHook = CONST_EXPR(new RouteLifecycleHook("canReuse"));
export const canDeactivate: RouteLifecycleHook =
    CONST_EXPR(new RouteLifecycleHook("canDeactivate"));
export const onActivate: RouteLifecycleHook = CONST_EXPR(new RouteLifecycleHook("onActivate"));
export const onReuse: RouteLifecycleHook = CONST_EXPR(new RouteLifecycleHook("onReuse"));
export const onDeactivate: RouteLifecycleHook = CONST_EXPR(new RouteLifecycleHook("onDeactivate"));
开发者ID:beta3000,项目名称:hola-angular2,代码行数:18,代码来源:lifecycle_annotations_impl.ts

示例9: constructor

}

@Injectable()
export class DebugElementViewListener implements AppViewListener {
  constructor(private _renderer: Renderer) {
    DOM.setGlobalVar(INSPECT_GLOBAL_NAME, inspectNativeElement);
  }

  onViewCreated(view: AppView) {
    var viewId = _nextId++;
    _allViewsById.set(viewId, view);
    _allIdsByView.set(view, viewId);
    for (var i = 0; i < view.elementRefs.length; i++) {
      var el = view.elementRefs[i];
      _setElementId(this._renderer.getNativeElementSync(el), [viewId, i]);
    }
  }

  onViewDestroyed(view: AppView) {
    var viewId = _allIdsByView.get(view);
    _allIdsByView.delete(view);
    _allViewsById.delete(viewId);
  }
}

export const ELEMENT_PROBE_PROVIDERS: any[] = CONST_EXPR([
  DebugElementViewListener,
  CONST_EXPR(new Provider(AppViewListener, {useExisting: DebugElementViewListener})),
]);

export const ELEMENT_PROBE_BINDINGS = ELEMENT_PROBE_PROVIDERS;
开发者ID:hankduan,项目名称:angular,代码行数:31,代码来源:debug_element_view_listener.ts


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