• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript di.provide函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: compilerProviders

export function compilerProviders(): Array<Type | Provider | any[]> {
  return [
    Lexer,
    Parser,
    HtmlParser,
    TemplateParser,
    TemplateNormalizer,
    RuntimeMetadataResolver,
    StyleCompiler,
    CommandCompiler,
    ChangeDetectionCompiler,
    provide(ChangeDetectorGenConfig,
            {
              useValue:
                  new ChangeDetectorGenConfig(assertionsEnabled(), assertionsEnabled(), false, true)
            }),
    TemplateCompiler,
    provide(RuntimeCompiler, {useClass: RuntimeCompiler_}),
    provide(Compiler, {useExisting: RuntimeCompiler}),
    DomElementSchemaRegistry,
    provide(ElementSchemaRegistry, {useExisting: DomElementSchemaRegistry}),
    AnchorBasedAppRootUrl,
    provide(AppRootUrl, {useExisting: AnchorBasedAppRootUrl}),
    UrlResolver
  ];
}
开发者ID:beta3000,项目名称:hola-angular2,代码行数:26,代码来源:compiler.ts


示例2: createInjector

export function createInjector(zone: NgZone, bus: MessageBus): Injector {
  BrowserDomAdapter.makeCurrent();
  _rootProviders.push(provide(NgZone, {useValue: zone}));
  _rootProviders.push(provide(MessageBus, {useValue: bus}));
  var injector: Injector = Injector.resolveAndCreate(_rootProviders);
  return injector.resolveAndCreateChild(_injectorProviders());
}
开发者ID:kreo,项目名称:angular-2-bootstraping,代码行数:7,代码来源:di_bindings.ts


示例3: bootstrap

export function bootstrap(appComponentType: any,
                          customProviders: ProviderArray = null) : Promise<ComponentRef> {
    NativeScriptDomAdapter.makeCurrent();

    let nativeScriptProviders: ProviderArray = [
        NativeScriptRootRenderer,
        provide(RootRenderer, {useClass: NativeScriptRootRenderer}),
        NativeScriptRenderer,
        provide(Renderer, {useClass: NativeScriptRenderer}),
        provide(XHR, {useClass: FileSystemXHR}),
        provide(ExceptionHandler, {useFactory: () => new ExceptionHandler(DOM, true), deps: []}),

        provide(PLATFORM_PIPES, {useValue: COMMON_PIPES, multi: true}),
        provide(PLATFORM_DIRECTIVES, {useValue: COMMON_DIRECTIVES, multi: true}),
        provide(PLATFORM_DIRECTIVES, {useValue: NS_DIRECTIVES, multi: true}),

        APPLICATION_COMMON_PROVIDERS,
        COMPILER_PROVIDERS,
        PLATFORM_COMMON_PROVIDERS,
        FORM_PROVIDERS,
    ];

    var appProviders = [];
    if (isPresent(customProviders)) {
        appProviders.push(customProviders);
    }

    const pageProvider = provide(Page, {useFactory: getDefaultPage});
    appProviders.push(pageProvider);
  
    if (!_platform) {
        _platform = platform(nativeScriptProviders);
    }
    return _platform.application(appProviders).bootstrap(appComponentType);
}
开发者ID:TheCreatives,项目名称:nativescript-angular,代码行数:35,代码来源:application.ts


示例4: applicationDomBindings

export function applicationDomBindings(): Array<Type | Provider | any[]> {
  if (isBlank(DOM)) {
    throw "Must set a root DOM adapter first.";
  }
  return [
    provide(DOCUMENT, {useValue: DOM.defaultDoc()}),
    EventManager,
    new Provider(EVENT_MANAGER_PLUGINS, {useClass: DomEventsPlugin, multi: true}),
    new Provider(EVENT_MANAGER_PLUGINS, {useClass: KeyEventsPlugin, multi: true}),
    new Provider(EVENT_MANAGER_PLUGINS, {useClass: HammerGesturesPlugin, multi: true}),
    provide(DomRenderer, {useClass: DomRenderer_}),
    provide(Renderer, {useExisting: DomRenderer}),
    DomSharedStylesHost,
    provide(SharedStylesHost, {useExisting: DomSharedStylesHost}),
    EXCEPTION_PROVIDER,
    provide(XHR, {useValue: new XHRImpl()}),
    Testability,
    BrowserDetails,
    AnimationBuilder,
    FORM_PROVIDERS
  ];
}
开发者ID:beta3000,项目名称:hola-angular2,代码行数:22,代码来源:application_common.ts


示例5: fuseBootstraper

export function fuseBootstraper(customProviders: ProviderArray = null): ApplicationRef {
    FuseDomAdapter.makeCurrent();

    let fuseProviders: ProviderArray = [
        FuseRenderer,
        provide(Renderer, {
            useClass: FuseRenderer
        }),
        FuseRootRenderer,
        provide(RootRenderer, {
            useClass: FuseRootRenderer
        }),
        provide(XHR, {
            useClass: FileSystemXHR
        }),
        provide(ExceptionHandler, {
            useFactory: () => new ExceptionHandler(DOM, true),
            deps: []
        }),

        provide(PLATFORM_PIPES, {
            useValue: COMMON_PIPES,
            multi: true
        }),
        provide(PLATFORM_DIRECTIVES, {
            useValue: COMMON_DIRECTIVES,
            multi: true
        }),

        APPLICATION_COMMON_PROVIDERS,
        COMPILER_PROVIDERS,
        PLATFORM_COMMON_PROVIDERS,
        ROUTER_PROVIDERS,
        FORM_PROVIDERS,
        HTTP_PROVIDERS,

        provide(LocationStrategy, {
            useClass: FuseLocationStrategy
        })
    ];

    let appProviders = [

    ];
    if (isPresent(customProviders)) {
        appProviders.push(customProviders);
    }
    if (!_platform) {
        _platform = platform(fuseProviders);
    }

    let app = _platform.application(appProviders);
    return app;
}
开发者ID:phamdt,项目名称:generator-mcfly-ng2,代码行数:54,代码来源:bootstrap.ts


示例6: bind

        .then((args) => {
          var capabilities = args[0];
          var userAgent = args[1];

          // This might still create instances twice. We are creating a new injector with all the
          // providers.
          // Only WebDriverAdapter is reused.
          // TODO vsavkin consider changing it when toAsyncFactory is added back or when child
          // injectors are handled better.
          var injector = Injector.resolveAndCreate([
            sampleBindings, bind(Options.CAPABILITIES).toValue(capabilities),
            bind(Options.USER_AGENT).toValue(userAgent),
            provide(WebDriverAdapter, {useValue: adapter})
          ]);

          var sampler = injector.get(Sampler);
          return sampler.sample();
        });
开发者ID:LordBinary,项目名称:angular,代码行数:18,代码来源:runner.ts


示例7: ChangeDetectorGenConfig

 () => [provide(
     ChangeDetectorGenConfig, {useValue: new ChangeDetectorGenConfig(true, false, false)})]);
开发者ID:LordBinary,项目名称:angular,代码行数:2,代码来源:change_detector_compiler_spec.ts


示例8: beforeEachProviders

 beforeEachProviders(() => [TEST_PROVIDERS, provide(ChangeDetectorGenConfig, {
                              useValue: new ChangeDetectorGenConfig(true, false, false)
                            })]);
开发者ID:LordBinary,项目名称:angular,代码行数:3,代码来源:change_detector_compiler_spec.ts


示例9: _getAppBindings

/**
 * Returns the application injector providers.
 *
 * This must be kept in sync with _injectorBindings() in application.js
 *
 * @returns {any[]}
 */
function _getAppBindings() {
  var appDoc;

  // The document is only available in browser environment
  try {
    appDoc = DOM.defaultDoc();
  } catch (e) {
    appDoc = null;
  }

  return [
    COMPILER_PROVIDERS,
    provide(ChangeDetectorGenConfig, {useValue: new ChangeDetectorGenConfig(true, false, true)}),
    provide(DOCUMENT, {useValue: appDoc}),
    provide(DomRenderer, {useClass: DomRenderer_}),
    provide(Renderer, {useExisting: DomRenderer}),
    provide(APP_ID, {useValue: 'a'}),
    DomSharedStylesHost,
    provide(SharedStylesHost, {useExisting: DomSharedStylesHost}),
    AppViewPool,
    provide(AppViewManager, {useClass: AppViewManager_}),
    AppViewManagerUtils,
    Serializer,
    ELEMENT_PROBE_PROVIDERS,
    provide(APP_VIEW_POOL_CAPACITY, {useValue: 500}),
    ProtoViewFactory,
    provide(DirectiveResolver, {useClass: MockDirectiveResolver}),
    provide(ViewResolver, {useClass: MockViewResolver}),
    provide(IterableDiffers, {useValue: defaultIterableDiffers}),
    provide(KeyValueDiffers, {useValue: defaultKeyValueDiffers}),
    Log,
    provide(DynamicComponentLoader, {useClass: DynamicComponentLoader_}),
    PipeResolver,
    provide(ExceptionHandler, {useValue: new ExceptionHandler(DOM)}),
    provide(LocationStrategy, {useClass: MockLocationStrategy}),
    provide(XHR, {useClass: DOM.getXHR()}),
    TestComponentBuilder,
    provide(NgZone, {useClass: MockNgZone}),
    provide(AnimationBuilder, {useClass: MockAnimationBuilder}),
    EventManager,
    new Provider(EVENT_MANAGER_PLUGINS, {useClass: DomEventsPlugin, multi: true})
  ];
}
开发者ID:zhangdanqing,项目名称:angular,代码行数:50,代码来源:test_injector.ts


示例10: RECEIVED_DATA

  // TODO(tbosch): use static values when our transpiler supports them
  static get RECEIVED_DATA() { return _RECEIVED_DATA; }
  // TODO(tbosch): use static values when our transpiler supports them
  static get REQUEST_COUNT() { return _REQUEST_COUNT; }
  // TODO(tbosch): use static values when our transpiler supports them
  static get CAPTURE_FRAMES() { return _CAPTURE_FRAMES; }
}

var _SAMPLE_ID = new OpaqueToken('Options.sampleId');
var _DEFAULT_DESCRIPTION = new OpaqueToken('Options.defaultDescription');
var _SAMPLE_DESCRIPTION = new OpaqueToken('Options.sampleDescription');
var _FORCE_GC = new OpaqueToken('Options.forceGc');
var _PREPARE = new OpaqueToken('Options.prepare');
var _EXECUTE = new OpaqueToken('Options.execute');
var _CAPABILITIES = new OpaqueToken('Options.capabilities');
var _USER_AGENT = new OpaqueToken('Options.userAgent');
var _MICRO_METRICS = new OpaqueToken('Options.microMetrics');
var _NOW = new OpaqueToken('Options.now');
var _WRITE_FILE = new OpaqueToken('Options.writeFile');
var _RECEIVED_DATA = new OpaqueToken('Options.receivedData');
var _REQUEST_COUNT = new OpaqueToken('Options.requestCount');
var _CAPTURE_FRAMES = new OpaqueToken('Options.frameCapture');

var _DEFAULT_PROVIDERS = [
  bind(_DEFAULT_DESCRIPTION).toValue({}), provide(_SAMPLE_DESCRIPTION, {useValue: {}}),
  provide(_FORCE_GC, {useValue: false}), provide(_PREPARE, {useValue: false}),
  provide(_MICRO_METRICS, {useValue: {}}), provide(_NOW, {useValue: () => DateWrapper.now()}),
  provide(_RECEIVED_DATA, {useValue: false}), provide(_REQUEST_COUNT, {useValue: false}),
  provide(_CAPTURE_FRAMES, {useValue: false})
];
开发者ID:LordBinary,项目名称:angular,代码行数:30,代码来源:common_options.ts



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript di.resolveForwardRef函数代码示例发布时间:2022-05-25
下一篇:
TypeScript di.bind函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap