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


TypeScript ReflectiveInjector.get方法代码示例

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


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

示例1: useInjector

export function useInjector() {
  var injector:ReflectiveInjector;

//#enddocregion injector
/*
//#docregion injector-no-new
  // Cannot 'new' an ReflectiveInjector like this!
  var injector = new ReflectiveInjector([Car, Engine, Tires, Logger]);
//#enddocregion injector-no-new
*/

//#docregion injector
  //#docregion injector-create-and-call
  injector = ReflectiveInjector.resolveAndCreate([Car, Engine, Tires, Logger]);
  //#docregion injector-call
  var car = injector.get(Car);
 //#enddocregion injector-call
 //#enddocregion injector-create-and-call
  car.description = 'Injector';

  var logger = injector.get(Logger);
  logger.log('Injector car.drive() said: '+car.drive());

  return car;
}
开发者ID:Xiahl1990,项目名称:angular.io,代码行数:25,代码来源:car-injector.ts

示例2: beforeEach

    beforeEach(() => {

      injector = ReflectiveInjector.resolveAndCreate([
        StoreModule.provideStore({ todos, todoCount }).providers
      ]);

      store = injector.get(Store);
      dispatcher = injector.get(Dispatcher);
    });
开发者ID:cartant,项目名称:store,代码行数:9,代码来源:edge.spec.ts

示例3: beforeEach

    beforeEach(() => {
      locationService = injector.get(LocationService);

      navService = injector.get(NavigationService);
      navService.currentNode.subscribe(selected => currentNode = selected);

      const backend = injector.get(ConnectionBackend);
      backend.connectionsArray[0].mockRespond(createResponse(navJson));
    });
开发者ID:lucidsoftware,项目名称:angular,代码行数:9,代码来源:navigation.service.spec.ts

示例4: beforeEach

    beforeEach(() => {
      location = injector.get(LocationService);

      service = injector.get(NavigationService);
      service.selectedNodes.subscribe(nodes => currentNodes = nodes);

      const backend = injector.get(ConnectionBackend);
      backend.connectionsArray[0].mockRespond(createResponse({ nav: nodeTree }));
    });
开发者ID:acramatte,项目名称:angular,代码行数:9,代码来源:navigation.service.spec.ts

示例5: beforeEach

  beforeEach(() => {
    spyOn(Reducer, 'reduce').and.callThrough();

    injector = ReflectiveInjector.resolveAndCreate([
      StoreModule.provideStore(Reducer.reduce, initialState).providers
    ]);

    state = injector.get(State);
    dispatcher = injector.get(Dispatcher);
  });
开发者ID:cartant,项目名称:store,代码行数:10,代码来源:state.spec.ts

示例6: beforeEach

  beforeEach(() => {
    injector = ReflectiveInjector.resolveAndCreate([
      ResourceService,
      { provide: ConnectionBackend, useClass: MockBackend },
      { provide: RequestOptions, useClass: BaseRequestOptions },
      Http
    ]);

    backend = injector.get(ConnectionBackend);
    resourceService = injector.get(ResourceService);
  });
开发者ID:DanielKucal,项目名称:angular,代码行数:11,代码来源:resource.service.spec.ts

示例7: beforeEach

    beforeEach(() => {
        const injector: ReflectiveInjector = DOTTestBed.resolveAndCreate([
            DotContainerContentletService
        ]);

        dotContainerContentletService = injector.get(DotContainerContentletService);
        backend = injector.get(ConnectionBackend);
        backend.connections.subscribe(
            (connection: MockConnection) => (lastConnection = connection)
        );
    });
开发者ID:dotCMS,项目名称:core-web,代码行数:11,代码来源:dot-container-contentlet.service.spec.ts

示例8: beforeEach

 beforeEach(() => {
     injector = ReflectiveInjector.resolveAndCreate([
         AlfrescoSearchService,
         AlfrescoSettingsService,
         AlfrescoApiService,
         AlfrescoAuthenticationService,
         StorageService
     ]);
     service = injector.get(AlfrescoSearchService);
     apiService = injector.get(AlfrescoApiService);
     spyOn(apiService, 'getInstance').and.returnValue(fakeApi);
 });
开发者ID:Pokhriyal,项目名称:alfresco-ng2-components,代码行数:12,代码来源:alfresco-search.service.spec.ts

示例9: beforeEach

  beforeEach(() => {
    injector = ReflectiveInjector.resolveAndCreate([
        ContributorService,
        { provide: ConnectionBackend, useClass: MockBackend },
        { provide: RequestOptions, useClass: BaseRequestOptions },
        Http,
        Logger
    ]);

    backend = injector.get(ConnectionBackend);
    contribService = injector.get(ContributorService);
  });
开发者ID:lucidsoftware,项目名称:angular,代码行数:12,代码来源:contributor.service.spec.ts


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