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


TypeScript di.ReflectiveInjector类代码示例

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


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

示例1: isPresent

 return this._compiler.resolveComponent(type).then(componentFactory => {
   var contextInjector = location.parentInjector;
   var childInjector = isPresent(providers) && providers.length > 0 ?
                           ReflectiveInjector.fromResolvedProviders(providers, contextInjector) :
                           contextInjector;
   return location.createComponent(componentFactory, location.length, childInjector,
                                   projectableNodes);
 });
开发者ID:AwelEshetu,项目名称:angular,代码行数:8,代码来源:dynamic_component_loader.ts

示例2: sample

  sample({id, execute, prepare, microMetrics, bindings}:
             {id: string, execute?: any, prepare?: any, microMetrics?: any, bindings?: any}):
      Promise<SampleState> {
    var sampleBindings = [
      _DEFAULT_PROVIDERS,
      this._defaultBindings,
      bind(Options.SAMPLE_ID).toValue(id),
      bind(Options.EXECUTE).toValue(execute)
    ];
    if (isPresent(prepare)) {
      sampleBindings.push(bind(Options.PREPARE).toValue(prepare));
    }
    if (isPresent(microMetrics)) {
      sampleBindings.push(bind(Options.MICRO_METRICS).toValue(microMetrics));
    }
    if (isPresent(bindings)) {
      sampleBindings.push(bindings);
    }

    var inj = ReflectiveInjector.resolveAndCreate(sampleBindings);
    var adapter = inj.get(WebDriverAdapter);

    return PromiseWrapper
        .all([adapter.capabilities(), adapter.executeScript('return window.navigator.userAgent;')])
        .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 = ReflectiveInjector.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:844496869,项目名称:angular,代码行数:44,代码来源:runner.ts

示例3: 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 = ReflectiveInjector.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:844496869,项目名称:angular,代码行数:19,代码来源:runner.ts


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