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

TypeScript core.ReflectiveInjector类代码示例

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

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



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

示例1:

 /**
  * Helper methods to add ComponentClass(like modal backdrop) with options
  * of type ComponentOptionsClass to element next to application root
  * or next to provided instance of view container
  * @param ComponentClass - @Component class
  * @param ComponentOptionsClass - options class
  * @param options - instance of options
  * @param contextInjector - injector to resolve root view container (any injector except root injector will fit)
  * @returns {ComponentRef<T>} - returns ComponentRef<T>
  */
 public appendNextToRoot<T>(ComponentClass:Type<T>,
                            ComponentOptionsClass:any,
                            options:any,
                            contextInjector:Injector):ComponentRef<T> {
   let location = this.getRootViewContainerRef(contextInjector);
   let providers = ReflectiveInjector.resolve([
     {provide: ComponentOptionsClass, useValue: options}
   ]);
   return this.appendNextToLocation(ComponentClass, location, providers);
 }
开发者ID:divino,项目名称:marklogic-data-hub,代码行数:20,代码来源:components-helper.service.ts


示例2: beforeEach

  beforeEach(function() {
    routeSet$ = new Subject<Match>();
    spyOn(router, 'replace');
    spyOn(observer, 'next');
    const injector = ReflectiveInjector.resolveAndCreate([
      provide(Router, { useValue: router })
    ]);

    redirect = injector.resolveAndInstantiate(RedirectHook);
  });
开发者ID:CoderMonkies,项目名称:router,代码行数:10,代码来源:redirect.spec.ts


示例3: beforeEach

  beforeEach(function() {
    routerInstruction$ = new Subject<Match>();
    const injector = ReflectiveInjector.resolveAndCreate([
      PARAMS_PROVIDERS,
      provide(RouterInstruction, { useValue: routerInstruction$ })
    ]);

    routeParams$ = injector.get(RouteParams);
    queryParams$ = injector.get(QueryParams);
  });
开发者ID:CoderMonkies,项目名称:router,代码行数:10,代码来源:params.spec.ts


示例4: beforeEach

    beforeEach(function () {
        const injector = ReflectiveInjector.resolveAndCreate([
            ShopEffects,
            MOCK_EFFECTS_PROVIDERS,
            // Mock out other dependencies (like Http) here
        ]);

        shop = injector.get(ShopEffects);
        updates$ = injector.get(MockStateUpdates);
    });
开发者ID:jhuntoo,项目名称:ngrx-examples,代码行数:10,代码来源:shop.spec.ts


示例5: useInjectors

 useInjectors(): void {
     let injector: any = ReflectiveInjector.resolveAndCreate([
         ViewPortService,
         provide('OtherSizeService', {useFactory: (viewport: any) => {
             return viewport.determineService();
         }, deps: [ViewPortService]})
     ]);
     let sizeService: any = injector.get('OtherSizeService');
     sizeService.run();
 }
开发者ID:clankford,项目名称:angular2-simpleDI,代码行数:10,代码来源:app.ts


示例6: it

 it('should infer type', () => {
   // #docregion InjectionToken
   const BASE_URL = new InjectionToken<string>('BaseUrl');
   const injector =
       ReflectiveInjector.resolveAndCreate([{provide: BASE_URL, useValue: 'http://localhost'}]);
   const url = injector.get(BASE_URL);
   // here `url` is inferred to be `string` because `BASE_URL` is `InjectionToken<string>`.
   expect(url).toBe('http://localhost');
   // #enddocregion
 });
开发者ID:IdeaBlade,项目名称:angular,代码行数:10,代码来源:injector_spec.ts


示例7: beforeEach

 beforeEach(() => {
   var injector = ReflectiveInjector.resolveAndCreate(
       [{provide: ResponseOptions, useClass: BaseResponseOptions}, MockBackend]);
   backend = injector.get(MockBackend);
   var base = new BaseRequestOptions();
   sampleRequest1 = new Request(base.merge(new RequestOptions({url: 'https://google.com'})));
   sampleResponse1 = new Response(new ResponseOptions({body: 'response1'}));
   sampleRequest2 = new Request(base.merge(new RequestOptions({url: 'https://google.com'})));
   sampleResponse2 = new Response(new ResponseOptions({body: 'response2'}));
 });
开发者ID:Coco-wan,项目名称:angular,代码行数:10,代码来源:mock_backend_spec.ts


示例8: beforeEach

 beforeEach(() => {
   let injector = ReflectiveInjector.resolveAndCreate([
     ROUTER_FAKE_PROVIDERS,
     // Angulartics2 relies on router for virtual page view tracking
     Angulartics2, Angulartics2Segment, AnalyticsService
   ]);
   analyticsService = injector.get(AnalyticsService);
   analyticsService.devMode(false);
   segment = injector.get(Angulartics2Segment);
 });
开发者ID:NathanWalker,项目名称:ngTunes,代码行数:10,代码来源:analytics.service.spec.ts


示例9: beforeEach

  beforeEach(() => {
    onerrorSpy = jasmine.createSpy('onerror');
    superHandler = spyOn(ErrorHandler.prototype, 'handleError');

    const injector = ReflectiveInjector.resolveAndCreate([
      { provide: ErrorHandler, useClass: ReportingErrorHandler },
      { provide: WindowToken, useFactory: () => ({ onerror: onerrorSpy }) }
    ]);
    handler = injector.get(ErrorHandler);
  });
开发者ID:BobChao87,项目名称:angular,代码行数:10,代码来源:reporting-error-handler.spec.ts


示例10: createInjector

function createInjector(initialUrl: string) {
  return ReflectiveInjector.resolveAndCreate([
      DocumentService,
      { provide: LocationService, useFactory: () => new MockLocationService(initialUrl) },
      { provide: ConnectionBackend, useClass: MockBackend },
      { provide: RequestOptions, useClass: BaseRequestOptions },
      { provide: Logger, useClass: MockLogger },
      Http,
  ]);
}
开发者ID:lucidsoftware,项目名称:angular,代码行数:10,代码来源:document.service.spec.ts



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
TypeScript core.Renderer类代码示例发布时间:2022-05-28
下一篇:
TypeScript core.QueryList类代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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