feat(bootstrap): add platform and app initializers
Often some init logic needs to run when a platform or an application is boostrapped. For example, boostraping a platform requires initializing the dom adapter. Now, it can be done as follows: new Provider(PLATFORM_INITIALIZER, {useValue: initDomAdapter, multi: true}), All platform initializers will be run after the platform injector has been created. Similarly, all application initializers will be run after the app injector has been created. Closes #5355
This commit is contained in:
@ -12,8 +12,7 @@ import {Type, isPresent, CONST_EXPR} from 'angular2/src/facade/lang';
|
||||
import {Promise} from 'angular2/src/facade/promise';
|
||||
import {
|
||||
BROWSER_PROVIDERS,
|
||||
BROWSER_APP_COMMON_PROVIDERS,
|
||||
initDomAdapter
|
||||
BROWSER_APP_COMMON_PROVIDERS
|
||||
} from 'angular2/src/platform/browser_common';
|
||||
import {ComponentRef, platform, reflector} from 'angular2/core';
|
||||
|
||||
@ -31,7 +30,6 @@ export const BROWSER_APP_PROVIDERS: Array<any /*Type | Provider | any[]*/> =
|
||||
export function bootstrapStatic(appComponentType: Type,
|
||||
customProviders?: Array<any /*Type | Provider | any[]*/>,
|
||||
initReflector?: Function): Promise<ComponentRef> {
|
||||
initDomAdapter();
|
||||
if (isPresent(initReflector)) {
|
||||
initReflector();
|
||||
}
|
||||
|
Reference in New Issue
Block a user