fix(bootstrap): swap coreBootstrap() and coreLoadAndBootstrap() arguments
This commit is contained in:
@ -51,7 +51,7 @@ export function createPlatform(injector: Injector): PlatformRef {
|
||||
export function assertPlatform(requiredToken: any): PlatformRef {
|
||||
var platform = getPlatform();
|
||||
if (isBlank(platform)) {
|
||||
throw new BaseException('Not platform exists!');
|
||||
throw new BaseException('No platform exists!');
|
||||
}
|
||||
if (isPresent(platform) && isBlank(platform.injector.get(requiredToken, null))) {
|
||||
throw new BaseException(
|
||||
@ -78,10 +78,10 @@ export function getPlatform(): PlatformRef {
|
||||
|
||||
/**
|
||||
* Shortcut for ApplicationRef.bootstrap.
|
||||
* Requires a platform the be created first.
|
||||
* Requires a platform to be created first.
|
||||
*/
|
||||
export function coreBootstrap<C>(injector: Injector,
|
||||
componentFactory: ComponentFactory<C>): ComponentRef<C> {
|
||||
export function coreBootstrap<C>(componentFactory: ComponentFactory<C>,
|
||||
injector: Injector): ComponentRef<C> {
|
||||
var appRef: ApplicationRef = injector.get(ApplicationRef);
|
||||
return appRef.bootstrap(componentFactory);
|
||||
}
|
||||
@ -89,10 +89,10 @@ export function coreBootstrap<C>(injector: Injector,
|
||||
/**
|
||||
* Resolves the componentFactory for the given component,
|
||||
* waits for asynchronous initializers and bootstraps the component.
|
||||
* Requires a platform the be created first.
|
||||
* Requires a platform to be created first.
|
||||
*/
|
||||
export function coreLoadAndBootstrap(injector: Injector,
|
||||
componentType: Type): Promise<ComponentRef<any>> {
|
||||
export function coreLoadAndBootstrap(componentType: Type,
|
||||
injector: Injector): Promise<ComponentRef<any>> {
|
||||
var appRef: ApplicationRef = injector.get(ApplicationRef);
|
||||
return appRef.run(() => {
|
||||
var componentResolver: ComponentResolver = injector.get(ComponentResolver);
|
||||
|
@ -25,7 +25,6 @@ import {
|
||||
Component,
|
||||
ReflectiveInjector,
|
||||
coreLoadAndBootstrap,
|
||||
coreBootstrap,
|
||||
PlatformRef,
|
||||
createPlatform,
|
||||
disposePlatform,
|
||||
@ -114,8 +113,8 @@ export function main() {
|
||||
}, 1);
|
||||
var app = createApplication(
|
||||
[{provide: APP_INITIALIZER, useValue: () => completer.promise, multi: true}]);
|
||||
coreLoadAndBootstrap(app.injector, MyComp6)
|
||||
.then((compRef) => {
|
||||
coreLoadAndBootstrap(MyComp6, app.injector)
|
||||
.then(_ => {
|
||||
expect(initializerDone).toBe(true);
|
||||
async.done();
|
||||
});
|
||||
|
Reference in New Issue
Block a user