本文整理汇总了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;
}
示例2: beforeEach
beforeEach(() => {
injector = ReflectiveInjector.resolveAndCreate([
StoreModule.provideStore({ todos, todoCount }).providers
]);
store = injector.get(Store);
dispatcher = injector.get(Dispatcher);
});
示例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));
});
示例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 }));
});
示例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);
});
示例6: beforeEach
beforeEach(() => {
injector = ReflectiveInjector.resolveAndCreate([
ResourceService,
{ provide: ConnectionBackend, useClass: MockBackend },
{ provide: RequestOptions, useClass: BaseRequestOptions },
Http
]);
backend = injector.get(ConnectionBackend);
resourceService = injector.get(ResourceService);
});
示例7: beforeEach
beforeEach(() => {
const injector: ReflectiveInjector = DOTTestBed.resolveAndCreate([
DotContainerContentletService
]);
dotContainerContentletService = injector.get(DotContainerContentletService);
backend = injector.get(ConnectionBackend);
backend.connections.subscribe(
(connection: MockConnection) => (lastConnection = connection)
);
});
示例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);
});
示例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);
});