當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。