refactor(core): fix bootstrapModule regarding zones and initializers (#10383)

This makes `bootstrapModuleFactory` wait for promises
returned by `APP_INITIALIZER`s, also making `bootstrapModuleFactory` async.
I.e. now `bootstrapModule` and `bootstrapModuleFactory` behave in the
same way.

This ensures that all code from module instantiation, to creating
`ApplicationRef`s as well as calling `APP_INITIALIZERS` is run
in the Angular zone.

This also moves the invocation of the initializers from the `ApplicationRef`
constructor into the `bootstrapModuleFactory` call, allowing initializers
to get a hold of `ApplicationRef` (see #9101).

Fixes #9101
Fixes #10363
Fixes #10205
This commit is contained in:
Tobias Bosch
2016-07-29 06:47:40 -07:00
parent 633c7d1ebe
commit a46437c57d
9 changed files with 223 additions and 211 deletions

View File

@ -16,10 +16,6 @@ import {HashLocationStrategy, LocationStrategy} from '@angular/common';
@Component({selector: 'app', templateUrl: 'app.html'})
export class App {
constructor(router: Router) {
// this should not be required once web worker bootstrap method can use modules
router.initialNavigation();
}
}
export const ROUTES = [