本文整理汇总了TypeScript中@angular/core.ReflectiveInjector.resolveAndCreate方法的典型用法代码示例。如果您正苦于以下问题:TypeScript ReflectiveInjector.resolveAndCreate方法的具体用法?TypeScript ReflectiveInjector.resolveAndCreate怎么用?TypeScript ReflectiveInjector.resolveAndCreate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@angular/core.ReflectiveInjector
的用法示例。
在下文中一共展示了ReflectiveInjector.resolveAndCreate方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: beforeEach
beforeEach(() => {
injector = ReflectiveInjector.resolveAndCreate([
AlfrescoSettingsService,
AlfrescoApiService,
AlfrescoAuthenticationService,
UploadService
]);
});
示例2: serverBootstrap
export function serverBootstrap(
appComponentType: Type,
customProviders?: Array<any /*Type | Provider | any[]*/>): Promise<ComponentRef<any>> {
reflector.reflectionCapabilities = new ReflectionCapabilities();
let providers = [SERVER_APPLICATION_PROVIDERS, customProviders || []];
var appInjector = ReflectiveInjector.resolveAndCreate(providers, serverPlatform().injector);
return coreLoadAndBootstrap(appComponentType, appInjector);
}
示例3: makeLocation
function makeLocation(
baseHref: string = '/my/app', provider: any = /*@ts2dart_const*/[]): Location {
locationStrategy = new MockLocationStrategy();
locationStrategy.internalBaseHref = baseHref;
let injector = ReflectiveInjector.resolveAndCreate(
[Location, {provide: LocationStrategy, useValue: locationStrategy}, provider]);
return location = injector.get(Location);
}
示例4: GET_HTTP_PROVIDERS_INJECTOR
export function GET_HTTP_PROVIDERS_INJECTOR(additionalProviders?: any[]): ReflectiveInjector {
if (additionalProviders) {
providers = providers.concat(additionalProviders);
}
return ReflectiveInjector.resolveAndCreate(providers);
}
示例5: beforeEach
beforeEach(function() {
const injector = ReflectiveInjector.resolveAndCreate([
MATCH_ROUTE_PROVIDERS,
RESOURCE_LOADER_PROVIDERS,
provide(ROUTES, { useValue: routes })
]);
traverser = injector.get(RouteTraverser);
});
示例6: bootstrapApp
export function bootstrapApp(
appComponentType: Type,
customProviders?: Array<any /*Type | Provider | any[]*/>): Promise<ComponentRef<any>> {
var appInjector = ReflectiveInjector.resolveAndCreate(
[WORKER_APP_DYNAMIC_APPLICATION_PROVIDERS, isPresent(customProviders) ? customProviders : []],
workerAppPlatform().injector);
return coreLoadAndBootstrap(appInjector, appComponentType);
}
示例7: bootstrap
export function bootstrap(
appComponentType: Type,
customProviders?: Array<any /*Type | Provider | any[]*/>): Promise<ComponentRef<any>> {
reflector.reflectionCapabilities = new ReflectionCapabilities();
var appInjector = ReflectiveInjector.resolveAndCreate(
[BROWSER_APP_PROVIDERS, isPresent(customProviders) ? customProviders : []],
browserPlatform().injector);
return coreLoadAndBootstrap(appInjector, appComponentType);
}
示例8: beforeEach
beforeEach(() => {
injector = ReflectiveInjector.resolveAndCreate([
StoreModule.provideStore({ todos, todoCount }).providers
]);
store = injector.get(Store);
dispatcher = injector.get(Dispatcher);
});
示例9: rawApiCall
/**
* Gets Angular2Apollo service and calls a method
*
* Checks if method with the same name has been called
* with the same same options
*
* It also checks if service method returns result of ApolloClient method
*
* @param {string} method Name of method you want to test
* @param {any} options Used options
* @param {any} result Mock result
*/
function rawApiCall(method: string, options = 'options', result = 'result') {
spyOn(client, method).and.returnValue(result);
const injector = ReflectiveInjector.resolveAndCreate([defaultApolloClient(client), APOLLO_PROVIDERS]);
const service = injector.get(Angular2Apollo);
expect(service[method](options)).toBe(result);
expect(client[method]).toHaveBeenCalledWith(options);
}
示例10: it
it('should work mockWrapper with fakeDI', () => {
let injector = ReflectiveInjector.resolveAndCreate([
MockWrapperService,
provide(TestService, { useClass: MockTestService })]);
let service = injector.get(MockWrapperService);
expect(service.getService()).toContain({ fname: 'vasya', lname: 'pupkin' });
});