refactor(core): change bootstrap of modules and names of platforms
BREAKING CHANGES: - `browserPlatform`/`browserDynamicPlatform`/... have been deprecated and renamed into `platformBrowser`/`platformBrowserDynamic`/.... - `bootstrapModule` and `bootstrapModuleFactory` have been moved to be members of `PlaformRef`. E.g. `platformBrowserDynamic().bootstrapModule(MyModule)`.
This commit is contained in:
parent
00b726f695
commit
5a21f168d6
|
@ -50,10 +50,9 @@ bootstrap.ts
|
||||||
-------------
|
-------------
|
||||||
|
|
||||||
import {MainModuleNgFactory} from './main_module.ngfactory';
|
import {MainModuleNgFactory} from './main_module.ngfactory';
|
||||||
import {bootstrapModuleFactory} from '@angular/core';
|
|
||||||
import {browserPlatform} from '@angular/platform-browser';
|
import {browserPlatform} from '@angular/platform-browser';
|
||||||
|
|
||||||
bootstrapModuleFactory(MainModuleNgFactory, browserPlatform());
|
browserPlatform().bootstrapModuleFactory(MainModuleNgFactory);
|
||||||
```
|
```
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
|
@ -14,7 +14,7 @@ import {AnimateCmp} from './animate';
|
||||||
import {BasicComp} from './basic';
|
import {BasicComp} from './basic';
|
||||||
import {CompWithAnalyzeEntryComponentsProvider, CompWithEntryComponents} from './entry_components';
|
import {CompWithAnalyzeEntryComponentsProvider, CompWithEntryComponents} from './entry_components';
|
||||||
import {CompWithProviders, CompWithReferences, ModuleUsingCustomElements} from './features';
|
import {CompWithProviders, CompWithReferences, ModuleUsingCustomElements} from './features';
|
||||||
import {CompUsingRootModuleDirectiveAndPipe, SomeDirectiveInRootModule, someLibModuleWithProviders, SomePipeInRootModule, SomeService} from './module_fixtures';
|
import {CompUsingRootModuleDirectiveAndPipe, SomeDirectiveInRootModule, SomePipeInRootModule, SomeService, someLibModuleWithProviders} from './module_fixtures';
|
||||||
import {ProjectingComp} from './projection';
|
import {ProjectingComp} from './projection';
|
||||||
import {CompWithChildQuery, CompWithDirectiveChild} from './queries';
|
import {CompWithChildQuery, CompWithDirectiveChild} from './queries';
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* found in the LICENSE file at https://angular.io/license
|
* found in the LICENSE file at https://angular.io/license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {NgModuleFactory, NgModuleRef, bootstrapModuleFactory} from '@angular/core';
|
import {NgModuleFactory, NgModuleRef} from '@angular/core';
|
||||||
import {ComponentFixture} from '@angular/core/testing';
|
import {ComponentFixture} from '@angular/core/testing';
|
||||||
import {serverPlatform} from '@angular/platform-server';
|
import {serverPlatform} from '@angular/platform-server';
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ import {MainModule} from '../src/module';
|
||||||
import {MainModuleNgFactory} from '../src/module.ngfactory';
|
import {MainModuleNgFactory} from '../src/module.ngfactory';
|
||||||
|
|
||||||
export function createModule(): NgModuleRef<MainModule> {
|
export function createModule(): NgModuleRef<MainModule> {
|
||||||
return bootstrapModuleFactory(MainModuleNgFactory, serverPlatform());
|
return serverPlatform().bootstrapModuleFactory(MainModuleNgFactory);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function createComponent<C>(comp: {new (...args: any[]): C}): ComponentFixture<C> {
|
export function createComponent<C>(comp: {new (...args: any[]): C}): ComponentFixture<C> {
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
* @description
|
* @description
|
||||||
* Starting point to import all compiler APIs.
|
* Starting point to import all compiler APIs.
|
||||||
*/
|
*/
|
||||||
export {COMPILER_PROVIDERS, CompileDiDependencyMetadata, CompileDirectiveMetadata, CompileFactoryMetadata, CompileIdentifierMetadata, CompileMetadataWithIdentifier, CompilePipeMetadata, CompileProviderMetadata, CompileQueryMetadata, CompileTemplateMetadata, CompileTokenMetadata, CompileTypeMetadata, CompilerConfig, DEFAULT_PACKAGE_URL_PROVIDER, DirectiveResolver, NgModuleResolver, OfflineCompiler, PipeResolver, RenderTypes, RuntimeCompiler, SourceModule, TEMPLATE_TRANSFORMS, UrlResolver, ViewResolver, XHR, analyzeAppProvidersForDeprecatedConfiguration, coreDynamicPlatform, createOfflineCompileUrlResolver} from './src/compiler';
|
export {COMPILER_PROVIDERS, CompileDiDependencyMetadata, CompileDirectiveMetadata, CompileFactoryMetadata, CompileIdentifierMetadata, CompileMetadataWithIdentifier, CompilePipeMetadata, CompileProviderMetadata, CompileQueryMetadata, CompileTemplateMetadata, CompileTokenMetadata, CompileTypeMetadata, CompilerConfig, DEFAULT_PACKAGE_URL_PROVIDER, DirectiveResolver, NgModuleResolver, OfflineCompiler, PipeResolver, RenderTypes, RuntimeCompiler, SourceModule, TEMPLATE_TRANSFORMS, UrlResolver, ViewResolver, XHR, analyzeAppProvidersForDeprecatedConfiguration, createOfflineCompileUrlResolver, platformCoreDynamic} from './src/compiler';
|
||||||
export {ElementSchemaRegistry} from './src/schema/element_schema_registry';
|
export {ElementSchemaRegistry} from './src/schema/element_schema_registry';
|
||||||
|
|
||||||
export * from './src/template_ast';
|
export * from './src/template_ast';
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* found in the LICENSE file at https://angular.io/license
|
* found in the LICENSE file at https://angular.io/license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {Compiler, CompilerFactory, CompilerOptions, Component, ComponentResolver, Inject, Injectable, NgModule, PLATFORM_DIRECTIVES, PLATFORM_INITIALIZER, PLATFORM_PIPES, PlatformRef, ReflectiveInjector, Type, ViewEncapsulation, corePlatform, createPlatformFactory, disposePlatform, isDevMode} from '@angular/core';
|
import {Compiler, CompilerFactory, CompilerOptions, Component, ComponentResolver, Inject, Injectable, NgModule, PLATFORM_DIRECTIVES, PLATFORM_INITIALIZER, PLATFORM_PIPES, PlatformRef, ReflectiveInjector, Type, ViewEncapsulation, createPlatformFactory, disposePlatform, isDevMode, platformCore} from '@angular/core';
|
||||||
|
|
||||||
export * from './template_ast';
|
export * from './template_ast';
|
||||||
export {TEMPLATE_TRANSFORMS} from './template_parser';
|
export {TEMPLATE_TRANSFORMS} from './template_parser';
|
||||||
|
@ -199,7 +199,7 @@ function _initReflector() {
|
||||||
*
|
*
|
||||||
* @experimental
|
* @experimental
|
||||||
*/
|
*/
|
||||||
export const coreDynamicPlatform = createPlatformFactory(corePlatform, 'coreDynamic', [
|
export const platformCoreDynamic = createPlatformFactory(platformCore, 'coreDynamic', [
|
||||||
{provide: CompilerOptions, useValue: {}, multi: true},
|
{provide: CompilerOptions, useValue: {}, multi: true},
|
||||||
{provide: CompilerFactory, useClass: RuntimeCompilerFactory},
|
{provide: CompilerFactory, useClass: RuntimeCompilerFactory},
|
||||||
{provide: PLATFORM_INITIALIZER, useValue: _initReflector, multi: true},
|
{provide: PLATFORM_INITIALIZER, useValue: _initReflector, multi: true},
|
||||||
|
|
|
@ -13,7 +13,7 @@ export * from './testing/directive_resolver_mock';
|
||||||
export * from './testing/ng_module_resolver_mock';
|
export * from './testing/ng_module_resolver_mock';
|
||||||
|
|
||||||
import {createPlatformFactory, CompilerOptions, PlatformRef} from '@angular/core';
|
import {createPlatformFactory, CompilerOptions, PlatformRef} from '@angular/core';
|
||||||
import {coreDynamicPlatform, DirectiveResolver, ViewResolver, NgModuleResolver} from './index';
|
import {platformCoreDynamic, DirectiveResolver, ViewResolver, NgModuleResolver} from './index';
|
||||||
import {MockViewResolver} from './testing/view_resolver_mock';
|
import {MockViewResolver} from './testing/view_resolver_mock';
|
||||||
import {MockDirectiveResolver} from './testing/directive_resolver_mock';
|
import {MockDirectiveResolver} from './testing/directive_resolver_mock';
|
||||||
import {MockNgModuleResolver} from './testing/ng_module_resolver_mock';
|
import {MockNgModuleResolver} from './testing/ng_module_resolver_mock';
|
||||||
|
@ -24,8 +24,8 @@ import {MockNgModuleResolver} from './testing/ng_module_resolver_mock';
|
||||||
*
|
*
|
||||||
* @experimental
|
* @experimental
|
||||||
*/
|
*/
|
||||||
export const coreDynamicTestingPlatform =
|
export const platformCoreDynamicTesting =
|
||||||
createPlatformFactory(coreDynamicPlatform, 'coreDynamicTesting', [{
|
createPlatformFactory(platformCoreDynamic, 'coreDynamicTesting', [{
|
||||||
provide: CompilerOptions,
|
provide: CompilerOptions,
|
||||||
useValue: {
|
useValue: {
|
||||||
providers: [
|
providers: [
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
export * from './src/metadata';
|
export * from './src/metadata';
|
||||||
export * from './src/util';
|
export * from './src/util';
|
||||||
export * from './src/di';
|
export * from './src/di';
|
||||||
export {createPlatform, assertPlatform, disposePlatform, getPlatform, bootstrapModuleFactory, bootstrapModule, coreBootstrap, coreLoadAndBootstrap, PlatformRef, ApplicationRef, enableProdMode, lockRunMode, isDevMode, createPlatformFactory} from './src/application_ref';
|
export {createPlatform, assertPlatform, disposePlatform, getPlatform, coreBootstrap, coreLoadAndBootstrap, PlatformRef, ApplicationRef, enableProdMode, lockRunMode, isDevMode, createPlatformFactory} from './src/application_ref';
|
||||||
export {APP_ID, APP_INITIALIZER, PACKAGE_ROOT_URL, PLATFORM_INITIALIZER} from './src/application_tokens';
|
export {APP_ID, APP_INITIALIZER, PACKAGE_ROOT_URL, PLATFORM_INITIALIZER} from './src/application_tokens';
|
||||||
export * from './src/zone';
|
export * from './src/zone';
|
||||||
export * from './src/render';
|
export * from './src/render';
|
||||||
|
|
|
@ -161,71 +161,6 @@ export function getPlatform(): PlatformRef {
|
||||||
return isPresent(_platform) && !_platform.disposed ? _platform : null;
|
return isPresent(_platform) && !_platform.disposed ? _platform : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates an instance of an `@NgModule` for the given platform
|
|
||||||
* for offline compilation.
|
|
||||||
*
|
|
||||||
* ## Simple Example
|
|
||||||
*
|
|
||||||
* ```typescript
|
|
||||||
* my_module.ts:
|
|
||||||
*
|
|
||||||
* @NgModule({
|
|
||||||
* imports: [BrowserModule]
|
|
||||||
* })
|
|
||||||
* class MyModule {}
|
|
||||||
*
|
|
||||||
* main.ts:
|
|
||||||
* import {MyModuleNgFactory} from './my_module.ngfactory';
|
|
||||||
* import {bootstrapModuleFactory} from '@angular/core';
|
|
||||||
* import {browserPlatform} from '@angular/platform-browser';
|
|
||||||
*
|
|
||||||
* let moduleRef = bootstrapModuleFactory(MyModuleNgFactory, browserPlatform());
|
|
||||||
* ```
|
|
||||||
*
|
|
||||||
* @experimental APIs related to application bootstrap are currently under review.
|
|
||||||
*/
|
|
||||||
export function bootstrapModuleFactory<M>(
|
|
||||||
moduleFactory: NgModuleFactory<M>, platform: PlatformRef): NgModuleRef<M> {
|
|
||||||
// Note: We need to create the NgZone _before_ we instantiate the module,
|
|
||||||
// as instantiating the module creates some providers eagerly.
|
|
||||||
// So we create a mini parent injector that just contains the new NgZone and
|
|
||||||
// pass that as parent to the NgModuleFactory.
|
|
||||||
const ngZone = new NgZone({enableLongStackTrace: isDevMode()});
|
|
||||||
const ngZoneInjector =
|
|
||||||
ReflectiveInjector.resolveAndCreate([{provide: NgZone, useValue: ngZone}], platform.injector);
|
|
||||||
return ngZone.run(() => moduleFactory.create(ngZoneInjector));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates an instance of an `@NgModule` for a given platform using the given runtime compiler.
|
|
||||||
*
|
|
||||||
* ## Simple Example
|
|
||||||
*
|
|
||||||
* ```typescript
|
|
||||||
* @NgModule({
|
|
||||||
* imports: [BrowserModule]
|
|
||||||
* })
|
|
||||||
* class MyModule {}
|
|
||||||
*
|
|
||||||
* let moduleRef = bootstrapModule(MyModule, browserPlatform());
|
|
||||||
* ```
|
|
||||||
* @stable
|
|
||||||
*/
|
|
||||||
export function bootstrapModule<M>(
|
|
||||||
moduleType: ConcreteType<M>, platform: PlatformRef,
|
|
||||||
compilerOptions: CompilerOptions | CompilerOptions[] = []): Promise<NgModuleRef<M>> {
|
|
||||||
const compilerFactory: CompilerFactory = platform.injector.get(CompilerFactory);
|
|
||||||
const compiler = compilerFactory.createCompiler(
|
|
||||||
compilerOptions instanceof Array ? compilerOptions : [compilerOptions]);
|
|
||||||
return compiler.compileModuleAsync(moduleType)
|
|
||||||
.then((moduleFactory) => bootstrapModuleFactory(moduleFactory, platform))
|
|
||||||
.then((moduleRef) => {
|
|
||||||
const appRef: ApplicationRef = moduleRef.injector.get(ApplicationRef);
|
|
||||||
return appRef.waitForAsyncInitializers().then(() => moduleRef);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shortcut for ApplicationRef.bootstrap.
|
* Shortcut for ApplicationRef.bootstrap.
|
||||||
* Requires a platform to be created first.
|
* Requires a platform to be created first.
|
||||||
|
@ -261,8 +196,56 @@ export function coreLoadAndBootstrap(
|
||||||
*/
|
*/
|
||||||
export abstract class PlatformRef {
|
export abstract class PlatformRef {
|
||||||
/**
|
/**
|
||||||
* Register a listener to be called when the platform is disposed.
|
* Creates an instance of an `@NgModule` for the given platform
|
||||||
|
* for offline compilation.
|
||||||
|
*
|
||||||
|
* ## Simple Example
|
||||||
|
*
|
||||||
|
* ```typescript
|
||||||
|
* my_module.ts:
|
||||||
|
*
|
||||||
|
* @NgModule({
|
||||||
|
* imports: [BrowserModule]
|
||||||
|
* })
|
||||||
|
* class MyModule {}
|
||||||
|
*
|
||||||
|
* main.ts:
|
||||||
|
* import {MyModuleNgFactory} from './my_module.ngfactory';
|
||||||
|
* import {browserPlatform} from '@angular/platform-browser';
|
||||||
|
*
|
||||||
|
* let moduleRef = browserPlatform().bootstrapModuleFactory(MyModuleNgFactory);
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* @experimental APIs related to application bootstrap are currently under review.
|
||||||
*/
|
*/
|
||||||
|
bootstrapModuleFactory<M>(moduleFactory: NgModuleFactory<M>): NgModuleRef<M> {
|
||||||
|
throw unimplemented();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates an instance of an `@NgModule` for a given platform using the given runtime compiler.
|
||||||
|
*
|
||||||
|
* ## Simple Example
|
||||||
|
*
|
||||||
|
* ```typescript
|
||||||
|
* @NgModule({
|
||||||
|
* imports: [BrowserModule]
|
||||||
|
* })
|
||||||
|
* class MyModule {}
|
||||||
|
*
|
||||||
|
* let moduleRef = browserPlatform().bootstrapModule(MyModule);
|
||||||
|
* ```
|
||||||
|
* @stable
|
||||||
|
*/
|
||||||
|
bootstrapModule<M>(
|
||||||
|
moduleType: ConcreteType<M>,
|
||||||
|
compilerOptions: CompilerOptions|CompilerOptions[] = []): Promise<NgModuleRef<M>> {
|
||||||
|
throw unimplemented();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*Register a listener to be called when the platform is disposed.
|
||||||
|
*/
|
||||||
abstract registerDisposeListener(dispose: () => void): void;
|
abstract registerDisposeListener(dispose: () => void): void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -313,6 +296,31 @@ export class PlatformRef_ extends PlatformRef {
|
||||||
|
|
||||||
/** @internal */
|
/** @internal */
|
||||||
_applicationDisposed(app: ApplicationRef): void { ListWrapper.remove(this._applications, app); }
|
_applicationDisposed(app: ApplicationRef): void { ListWrapper.remove(this._applications, app); }
|
||||||
|
|
||||||
|
bootstrapModuleFactory<M>(moduleFactory: NgModuleFactory<M>): NgModuleRef<M> {
|
||||||
|
// Note: We need to create the NgZone _before_ we instantiate the module,
|
||||||
|
// as instantiating the module creates some providers eagerly.
|
||||||
|
// So we create a mini parent injector that just contains the new NgZone and
|
||||||
|
// pass that as parent to the NgModuleFactory.
|
||||||
|
const ngZone = new NgZone({enableLongStackTrace: isDevMode()});
|
||||||
|
const ngZoneInjector =
|
||||||
|
ReflectiveInjector.resolveAndCreate([{provide: NgZone, useValue: ngZone}], this.injector);
|
||||||
|
return ngZone.run(() => moduleFactory.create(ngZoneInjector));
|
||||||
|
}
|
||||||
|
|
||||||
|
bootstrapModule<M>(
|
||||||
|
moduleType: ConcreteType<M>,
|
||||||
|
compilerOptions: CompilerOptions|CompilerOptions[] = []): Promise<NgModuleRef<M>> {
|
||||||
|
const compilerFactory: CompilerFactory = this.injector.get(CompilerFactory);
|
||||||
|
const compiler = compilerFactory.createCompiler(
|
||||||
|
compilerOptions instanceof Array ? compilerOptions : [compilerOptions]);
|
||||||
|
return compiler.compileModuleAsync(moduleType)
|
||||||
|
.then((moduleFactory) => this.bootstrapModuleFactory(moduleFactory))
|
||||||
|
.then((moduleRef) => {
|
||||||
|
const appRef: ApplicationRef = moduleRef.injector.get(ApplicationRef);
|
||||||
|
return appRef.waitForAsyncInitializers().then(() => moduleRef);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -32,7 +32,7 @@ const _CORE_PLATFORM_PROVIDERS: Array<any|Type|Provider|any[]> = [
|
||||||
*
|
*
|
||||||
* @experimental
|
* @experimental
|
||||||
*/
|
*/
|
||||||
export const corePlatform = createPlatformFactory(null, 'core', _CORE_PLATFORM_PROVIDERS);
|
export const platformCore = createPlatformFactory(null, 'core', _CORE_PLATFORM_PROVIDERS);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A default set of providers which should be included in any Angular platform.
|
* A default set of providers which should be included in any Angular platform.
|
||||||
|
|
|
@ -10,8 +10,8 @@ import {AsyncTestCompleter, ddescribe, describe, it, iit, xit, expect, beforeEac
|
||||||
import {SpyChangeDetectorRef} from './spies';
|
import {SpyChangeDetectorRef} from './spies';
|
||||||
import {ConcreteType} from '../src/facade/lang';
|
import {ConcreteType} from '../src/facade/lang';
|
||||||
import {ApplicationRef_, ApplicationRef} from '@angular/core/src/application_ref';
|
import {ApplicationRef_, ApplicationRef} from '@angular/core/src/application_ref';
|
||||||
import {Type, NgModule, CompilerFactory, Injector, APP_INITIALIZER, Component, ReflectiveInjector, bootstrapModule, bootstrapModuleFactory, PlatformRef, disposePlatform, createPlatformFactory, ComponentResolver, ComponentFactoryResolver, ChangeDetectorRef, ApplicationModule} from '@angular/core';
|
import {Type, NgModule, CompilerFactory, Injector, APP_INITIALIZER, Component, ReflectiveInjector, PlatformRef, disposePlatform, createPlatformFactory, ComponentResolver, ComponentFactoryResolver, ChangeDetectorRef, ApplicationModule} from '@angular/core';
|
||||||
import {coreDynamicPlatform} from '@angular/compiler';
|
import {platformCoreDynamic} from '@angular/compiler';
|
||||||
import {Console} from '@angular/core/src/console';
|
import {Console} from '@angular/core/src/console';
|
||||||
import {BaseException} from '../src/facade/exceptions';
|
import {BaseException} from '../src/facade/exceptions';
|
||||||
import {PromiseWrapper, PromiseCompleter, TimerWrapper} from '../src/facade/async';
|
import {PromiseWrapper, PromiseCompleter, TimerWrapper} from '../src/facade/async';
|
||||||
|
@ -28,7 +28,7 @@ export function main() {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
errorLogger = new _ArrayLogger();
|
errorLogger = new _ArrayLogger();
|
||||||
disposePlatform();
|
disposePlatform();
|
||||||
defaultPlatform = createPlatformFactory(coreDynamicPlatform, 'test')();
|
defaultPlatform = createPlatformFactory(platformCoreDynamic, 'test')();
|
||||||
someCompFactory =
|
someCompFactory =
|
||||||
new _MockComponentFactory(new _MockComponentRef(ReflectiveInjector.resolveAndCreate([])));
|
new _MockComponentFactory(new _MockComponentRef(ReflectiveInjector.resolveAndCreate([])));
|
||||||
appProviders = [
|
appProviders = [
|
||||||
|
@ -53,7 +53,7 @@ export function main() {
|
||||||
const compilerFactory: CompilerFactory = platform.injector.get(CompilerFactory);
|
const compilerFactory: CompilerFactory = platform.injector.get(CompilerFactory);
|
||||||
const compiler = compilerFactory.createCompiler();
|
const compiler = compilerFactory.createCompiler();
|
||||||
const appInjector =
|
const appInjector =
|
||||||
bootstrapModuleFactory(compiler.compileModuleSync(createModule(providers)), platform)
|
platform.bootstrapModuleFactory(compiler.compileModuleSync(createModule(providers)))
|
||||||
.injector;
|
.injector;
|
||||||
return appInjector.get(ApplicationRef);
|
return appInjector.get(ApplicationRef);
|
||||||
}
|
}
|
||||||
|
@ -100,10 +100,9 @@ export function main() {
|
||||||
initializerDone = true;
|
initializerDone = true;
|
||||||
}, 1);
|
}, 1);
|
||||||
|
|
||||||
bootstrapModule(
|
defaultPlatform
|
||||||
createModule(
|
.bootstrapModule(createModule(
|
||||||
[{provide: APP_INITIALIZER, useValue: () => completer.promise, multi: true}]),
|
[{provide: APP_INITIALIZER, useValue: () => completer.promise, multi: true}]))
|
||||||
defaultPlatform)
|
|
||||||
.then(_ => {
|
.then(_ => {
|
||||||
expect(initializerDone).toBe(true);
|
expect(initializerDone).toBe(true);
|
||||||
async.done();
|
async.done();
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* found in the LICENSE file at https://angular.io/license
|
* found in the LICENSE file at https://angular.io/license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {Compiler, SchemaMetadata, CompilerFactory, CompilerOptions, ComponentStillLoadingError, Injector, NgModule, NgModuleFactory, NgModuleMetadata, NgModuleRef, PlatformRef, Provider, ReflectiveInjector, Type, assertPlatform, createPlatform, getPlatform} from '../index';
|
import {Compiler, CompilerFactory, CompilerOptions, ComponentStillLoadingError, Injector, NgModule, NgModuleFactory, NgModuleMetadata, NgModuleRef, PlatformRef, Provider, ReflectiveInjector, SchemaMetadata, Type, assertPlatform, createPlatform, getPlatform} from '../index';
|
||||||
import {ListWrapper} from '../src/facade/collection';
|
import {ListWrapper} from '../src/facade/collection';
|
||||||
import {BaseException} from '../src/facade/exceptions';
|
import {BaseException} from '../src/facade/exceptions';
|
||||||
import {ConcreteType, FunctionWrapper, isPresent, stringify} from '../src/facade/lang';
|
import {ConcreteType, FunctionWrapper, isPresent, stringify} from '../src/facade/lang';
|
||||||
|
|
|
@ -6,9 +6,9 @@
|
||||||
* found in the LICENSE file at https://angular.io/license
|
* found in the LICENSE file at https://angular.io/license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {Component, ReflectiveInjector, bootstrapModule, createPlatformFactory} from '@angular/core';
|
import {Component, ReflectiveInjector, createPlatformFactory} from '@angular/core';
|
||||||
import {BrowserModule} from '@angular/platform-browser';
|
import {BrowserModule} from '@angular/platform-browser';
|
||||||
import {browserDynamicPlatform} from '@angular/platform-browser-dynamic';
|
import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';
|
||||||
|
|
||||||
var appProviders: any[] = [];
|
var appProviders: any[] = [];
|
||||||
|
|
||||||
|
@ -17,6 +17,6 @@ var appProviders: any[] = [];
|
||||||
class MyApp {
|
class MyApp {
|
||||||
}
|
}
|
||||||
|
|
||||||
var myPlatformFactory = createPlatformFactory(browserDynamicPlatform, 'myPlatform');
|
var myPlatformFactory = createPlatformFactory(platformBrowserDynamic, 'myPlatform');
|
||||||
bootstrapModule(MyApp, myPlatformFactory());
|
myPlatformFactory().bootstrapModule(MyApp);
|
||||||
// #enddocregion
|
// #enddocregion
|
||||||
|
|
|
@ -6,9 +6,9 @@
|
||||||
* found in the LICENSE file at https://angular.io/license
|
* found in the LICENSE file at https://angular.io/license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {XHR, analyzeAppProvidersForDeprecatedConfiguration, coreDynamicPlatform} from '@angular/compiler';
|
import {XHR, analyzeAppProvidersForDeprecatedConfiguration, platformCoreDynamic} from '@angular/compiler';
|
||||||
import {SchemaMetadata, ApplicationRef, Compiler, CompilerFactory, CompilerOptions, ComponentRef, ComponentResolver, ExceptionHandler, NgModule, NgModuleRef, OpaqueToken, PLATFORM_DIRECTIVES, PLATFORM_INITIALIZER, PLATFORM_PIPES, PlatformRef, ReflectiveInjector, Type, assertPlatform, bootstrapModule, bootstrapModuleFactory, createPlatform, createPlatformFactory, getPlatform, isDevMode} from '@angular/core';
|
import {ApplicationRef, Compiler, CompilerFactory, CompilerOptions, ComponentRef, ComponentResolver, ExceptionHandler, NgModule, NgModuleRef, OpaqueToken, PLATFORM_DIRECTIVES, PLATFORM_INITIALIZER, PLATFORM_PIPES, PlatformRef, ReflectiveInjector, SchemaMetadata, Type, assertPlatform, createPlatform, createPlatformFactory, getPlatform, isDevMode} from '@angular/core';
|
||||||
import {BROWSER_PLATFORM_PROVIDERS, BrowserModule, WORKER_APP_PLATFORM_PROVIDERS, WORKER_SCRIPT, WorkerAppModule, browserPlatform, workerAppPlatform, workerUiPlatform} from '@angular/platform-browser';
|
import {BROWSER_PLATFORM_PROVIDERS, BrowserModule, WORKER_APP_PLATFORM_PROVIDERS, WORKER_SCRIPT, WorkerAppModule, platformBrowser, platformWorkerApp, platformWorkerUi} from '@angular/platform-browser';
|
||||||
|
|
||||||
import {Console} from './core_private';
|
import {Console} from './core_private';
|
||||||
import {PromiseWrapper} from './src/facade/async';
|
import {PromiseWrapper} from './src/facade/async';
|
||||||
|
@ -34,8 +34,13 @@ export const CACHED_TEMPLATE_PROVIDER: Array<any /*Type | Provider | any[]*/> =
|
||||||
/**
|
/**
|
||||||
* @experimental API related to bootstrapping are still under review.
|
* @experimental API related to bootstrapping are still under review.
|
||||||
*/
|
*/
|
||||||
export const browserDynamicPlatform = createPlatformFactory(
|
export const platformBrowserDynamic = createPlatformFactory(
|
||||||
coreDynamicPlatform, 'browserDynamic', INTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS);
|
platformCoreDynamic, 'browserDynamic', INTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated Use {@link platformBrowserDynamic} instead
|
||||||
|
*/
|
||||||
|
export const browserDynamicPlatform = platformBrowserDynamic;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bootstrapping for Angular applications.
|
* Bootstrapping for Angular applications.
|
||||||
|
@ -170,7 +175,8 @@ export function bootstrap<C>(
|
||||||
class DynamicModule {
|
class DynamicModule {
|
||||||
}
|
}
|
||||||
|
|
||||||
return bootstrapModule(DynamicModule, browserDynamicPlatform(), compilerOptions)
|
return platformBrowserDynamic()
|
||||||
|
.bootstrapModule(DynamicModule, compilerOptions)
|
||||||
.then((moduleRef) => {
|
.then((moduleRef) => {
|
||||||
const console = moduleRef.injector.get(Console);
|
const console = moduleRef.injector.get(Console);
|
||||||
deprecationMessages.forEach((msg) => console.warn(msg));
|
deprecationMessages.forEach((msg) => console.warn(msg));
|
||||||
|
@ -188,7 +194,7 @@ export function bootstrapWorkerUi(
|
||||||
workerScriptUri: string,
|
workerScriptUri: string,
|
||||||
customProviders: Array<any /*Type | Provider | any[]*/> = []): Promise<PlatformRef> {
|
customProviders: Array<any /*Type | Provider | any[]*/> = []): Promise<PlatformRef> {
|
||||||
// For now, just creates the worker ui platform...
|
// For now, just creates the worker ui platform...
|
||||||
return Promise.resolve(workerUiPlatform([{
|
return Promise.resolve(platformWorkerUi([{
|
||||||
provide: WORKER_SCRIPT,
|
provide: WORKER_SCRIPT,
|
||||||
useValue: workerScriptUri,
|
useValue: workerScriptUri,
|
||||||
}].concat(customProviders)));
|
}].concat(customProviders)));
|
||||||
|
@ -197,13 +203,18 @@ export function bootstrapWorkerUi(
|
||||||
/**
|
/**
|
||||||
* @experimental API related to bootstrapping are still under review.
|
* @experimental API related to bootstrapping are still under review.
|
||||||
*/
|
*/
|
||||||
export const workerAppDynamicPlatform =
|
export const platformWorkerAppDynamic =
|
||||||
createPlatformFactory(coreDynamicPlatform, 'workerAppDynamic', [{
|
createPlatformFactory(platformCoreDynamic, 'workerAppDynamic', [{
|
||||||
provide: CompilerOptions,
|
provide: CompilerOptions,
|
||||||
useValue: {providers: [{provide: XHR, useClass: XHRImpl}]},
|
useValue: {providers: [{provide: XHR, useClass: XHRImpl}]},
|
||||||
multi: true
|
multi: true
|
||||||
}]);
|
}]);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated Use {@link platformWorkerAppDynamic} instead
|
||||||
|
*/
|
||||||
|
export const workerAppDynamicPlatform = platformWorkerAppDynamic;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated Create an {@link NgModule} that includes the {@link WorkerAppModule} and use {@link
|
* @deprecated Create an {@link NgModule} that includes the {@link WorkerAppModule} and use {@link
|
||||||
* bootstrapModule}
|
* bootstrapModule}
|
||||||
|
@ -227,8 +238,8 @@ export function bootstrapWorkerApp<T>(
|
||||||
class DynamicModule {
|
class DynamicModule {
|
||||||
}
|
}
|
||||||
|
|
||||||
return bootstrapModule(
|
return platformWorkerAppDynamic()
|
||||||
DynamicModule, workerAppDynamicPlatform(), deprecatedConfiguration.compilerOptions)
|
.bootstrapModule(DynamicModule, deprecatedConfiguration.compilerOptions)
|
||||||
.then((moduleRef) => {
|
.then((moduleRef) => {
|
||||||
const console = moduleRef.injector.get(Console);
|
const console = moduleRef.injector.get(Console);
|
||||||
deprecatedConfiguration.deprecationMessages.forEach((msg) => console.warn(msg));
|
deprecatedConfiguration.deprecationMessages.forEach((msg) => console.warn(msg));
|
||||||
|
|
|
@ -7,13 +7,12 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {CompilerConfig, DirectiveResolver, NgModuleResolver, ViewResolver, analyzeAppProvidersForDeprecatedConfiguration} from '@angular/compiler';
|
import {CompilerConfig, DirectiveResolver, NgModuleResolver, ViewResolver, analyzeAppProvidersForDeprecatedConfiguration} from '@angular/compiler';
|
||||||
import {OverridingTestComponentBuilder, coreDynamicTestingPlatform} from '@angular/compiler/testing';
|
import {OverridingTestComponentBuilder, platformCoreDynamicTesting} from '@angular/compiler/testing';
|
||||||
import {Compiler, CompilerFactory, CompilerOptions, NgModule, PlatformRef, Provider, ReflectiveInjector, Type, createPlatform, createPlatformFactory} from '@angular/core';
|
import {Compiler, CompilerFactory, CompilerOptions, NgModule, PlatformRef, Provider, ReflectiveInjector, Type, createPlatform, createPlatformFactory} from '@angular/core';
|
||||||
import {TestComponentBuilder, TestComponentRenderer, initTestEnvironment} from '@angular/core/testing';
|
import {TestComponentBuilder, TestComponentRenderer, initTestEnvironment} from '@angular/core/testing';
|
||||||
import {BrowserTestingModule, browserTestingPlatform} from '@angular/platform-browser/testing';
|
import {BrowserTestingModule, platformBrowserTesting} from '@angular/platform-browser/testing';
|
||||||
|
|
||||||
import {Console} from './core_private';
|
import {Console} from './core_private';
|
||||||
import {browserDynamicPlatform} from './index';
|
|
||||||
import {INTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS} from './src/platform_providers';
|
import {INTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS} from './src/platform_providers';
|
||||||
import {DOMTestComponentRenderer} from './testing/dom_test_component_renderer';
|
import {DOMTestComponentRenderer} from './testing/dom_test_component_renderer';
|
||||||
|
|
||||||
|
@ -22,10 +21,15 @@ export * from './private_export_testing'
|
||||||
/**
|
/**
|
||||||
* @experimental API related to bootstrapping are still under review.
|
* @experimental API related to bootstrapping are still under review.
|
||||||
*/
|
*/
|
||||||
export const browserDynamicTestingPlatform = createPlatformFactory(
|
export const platformBrowserDynamicTesting = createPlatformFactory(
|
||||||
coreDynamicTestingPlatform, 'browserDynamicTesting',
|
platformCoreDynamicTesting, 'browserDynamicTesting',
|
||||||
INTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS);
|
INTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated Use {@link platformBrowserDynamicTesting} instead
|
||||||
|
*/
|
||||||
|
export const browserDynamicTestingPlatform = platformBrowserDynamicTesting;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* NgModule for testing.
|
* NgModule for testing.
|
||||||
*
|
*
|
||||||
|
@ -50,7 +54,7 @@ export const TEST_BROWSER_DYNAMIC_PLATFORM_PROVIDERS: Array<any /*Type | Provide
|
||||||
[(appProviders: any[]) => {
|
[(appProviders: any[]) => {
|
||||||
const deprecatedConfiguration = analyzeAppProvidersForDeprecatedConfiguration(appProviders);
|
const deprecatedConfiguration = analyzeAppProvidersForDeprecatedConfiguration(appProviders);
|
||||||
const platformRef =
|
const platformRef =
|
||||||
createPlatformFactory(browserDynamicTestingPlatform, 'browserDynamicTestingDeprecated', [{
|
createPlatformFactory(platformBrowserDynamicTesting, 'browserDynamicTestingDeprecated', [{
|
||||||
provide: CompilerOptions,
|
provide: CompilerOptions,
|
||||||
useValue: deprecatedConfiguration.compilerOptions,
|
useValue: deprecatedConfiguration.compilerOptions,
|
||||||
multi: true
|
multi: true
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* found in the LICENSE file at https://angular.io/license
|
* found in the LICENSE file at https://angular.io/license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export {BROWSER_APP_PROVIDERS, BROWSER_PLATFORM_PROVIDERS, BROWSER_SANITIZATION_PROVIDERS, BrowserModule, browserPlatform} from './src/browser';
|
export {BROWSER_APP_PROVIDERS, BROWSER_PLATFORM_PROVIDERS, BROWSER_SANITIZATION_PROVIDERS, BrowserModule, platformBrowser} from './src/browser';
|
||||||
export {BrowserPlatformLocation} from './src/browser/location/browser_platform_location';
|
export {BrowserPlatformLocation} from './src/browser/location/browser_platform_location';
|
||||||
export {Title} from './src/browser/title';
|
export {Title} from './src/browser/title';
|
||||||
export {disableDebugTools, enableDebugTools} from './src/browser/tools/tools';
|
export {disableDebugTools, enableDebugTools} from './src/browser/tools/tools';
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {CommonModule, PlatformLocation} from '@angular/common';
|
import {CommonModule, PlatformLocation} from '@angular/common';
|
||||||
import {ApplicationModule, ExceptionHandler, NgModule, NgModuleFactory, NgModuleRef, NgZone, OpaqueToken, PLATFORM_COMMON_PROVIDERS, PLATFORM_INITIALIZER, PlatformRef, ReflectiveInjector, RootRenderer, SanitizationService, Testability, assertPlatform, corePlatform, createPlatform, createPlatformFactory, getPlatform, isDevMode} from '@angular/core';
|
import {ApplicationModule, ExceptionHandler, NgModule, NgModuleFactory, NgModuleRef, NgZone, OpaqueToken, PLATFORM_COMMON_PROVIDERS, PLATFORM_INITIALIZER, PlatformRef, ReflectiveInjector, RootRenderer, SanitizationService, Testability, assertPlatform, createPlatform, createPlatformFactory, getPlatform, isDevMode, platformCore} from '@angular/core';
|
||||||
|
|
||||||
import {wtfInit} from '../core_private';
|
import {wtfInit} from '../core_private';
|
||||||
import {AnimationDriver} from '../src/dom/animation_driver';
|
import {AnimationDriver} from '../src/dom/animation_driver';
|
||||||
|
@ -38,8 +38,8 @@ export const INTERNAL_BROWSER_PLATFORM_PROVIDERS: Array<any /*Type | Provider |
|
||||||
*
|
*
|
||||||
* Used automatically by `bootstrap`, or can be passed to `platform`.
|
* Used automatically by `bootstrap`, or can be passed to `platform`.
|
||||||
*
|
*
|
||||||
* @deprecated Use `browserPlatform()` or create a custom platform factory via
|
* @deprecated Use `platformBrowser()` or create a custom platform factory via
|
||||||
* `createPlatformFactory(browserPlatform, ...)`
|
* `createPlatformFactory(platformBrowser, ...)`
|
||||||
*/
|
*/
|
||||||
export const BROWSER_PLATFORM_PROVIDERS: Array<any /*Type | Provider | any[]*/> =
|
export const BROWSER_PLATFORM_PROVIDERS: Array<any /*Type | Provider | any[]*/> =
|
||||||
[PLATFORM_COMMON_PROVIDERS, INTERNAL_BROWSER_PLATFORM_PROVIDERS];
|
[PLATFORM_COMMON_PROVIDERS, INTERNAL_BROWSER_PLATFORM_PROVIDERS];
|
||||||
|
@ -71,8 +71,13 @@ export const BROWSER_APP_PROVIDERS: Array<any /*Type | Provider | any[]*/> = [];
|
||||||
/**
|
/**
|
||||||
* @experimental API related to bootstrapping are still under review.
|
* @experimental API related to bootstrapping are still under review.
|
||||||
*/
|
*/
|
||||||
export const browserPlatform =
|
export const platformBrowser =
|
||||||
createPlatformFactory(corePlatform, 'browser', INTERNAL_BROWSER_PLATFORM_PROVIDERS);
|
createPlatformFactory(platformCore, 'browser', INTERNAL_BROWSER_PLATFORM_PROVIDERS);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated Use {@link platformBrowser} instead
|
||||||
|
*/
|
||||||
|
export const browserPlatform = platformBrowser;
|
||||||
|
|
||||||
export function initDomAdapter() {
|
export function initDomAdapter() {
|
||||||
BrowserDomAdapter.makeCurrent();
|
BrowserDomAdapter.makeCurrent();
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {CommonModule, FORM_PROVIDERS} from '@angular/common';
|
import {CommonModule, FORM_PROVIDERS} from '@angular/common';
|
||||||
import {APP_INITIALIZER, ApplicationModule, ExceptionHandler, NgModule, NgZone, OpaqueToken, PLATFORM_COMMON_PROVIDERS, PlatformRef, ReflectiveInjector, RootRenderer, assertPlatform, corePlatform, createPlatform, createPlatformFactory, getPlatform} from '@angular/core';
|
import {APP_INITIALIZER, ApplicationModule, ExceptionHandler, NgModule, NgZone, OpaqueToken, PLATFORM_COMMON_PROVIDERS, PlatformRef, ReflectiveInjector, RootRenderer, assertPlatform, createPlatform, createPlatformFactory, getPlatform, platformCore} from '@angular/core';
|
||||||
|
|
||||||
import {BROWSER_SANITIZATION_PROVIDERS} from './browser';
|
import {BROWSER_SANITIZATION_PROVIDERS} from './browser';
|
||||||
import {isBlank, print} from './facade/lang';
|
import {isBlank, print} from './facade/lang';
|
||||||
|
@ -29,8 +29,8 @@ class PrintLogger {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated Use `workerAppPlatform()` or create a custom platform factory via
|
* @deprecated Use `platformWorkerApp()` or create a custom platform factory via
|
||||||
* `createPlatformFactory(workerAppPlatform, ...)`
|
* `createPlatformFactory(platformWorkerApp, ...)`
|
||||||
*/
|
*/
|
||||||
export const WORKER_APP_PLATFORM_PROVIDERS: Array<any /*Type | Provider | any[]*/> =
|
export const WORKER_APP_PLATFORM_PROVIDERS: Array<any /*Type | Provider | any[]*/> =
|
||||||
PLATFORM_COMMON_PROVIDERS;
|
PLATFORM_COMMON_PROVIDERS;
|
||||||
|
@ -46,7 +46,12 @@ export const WORKER_APP_APPLICATION_PROVIDERS: Array<any /*Type | Provider | any
|
||||||
/**
|
/**
|
||||||
* @experimental
|
* @experimental
|
||||||
*/
|
*/
|
||||||
export const workerAppPlatform = createPlatformFactory(corePlatform, 'workerApp');
|
export const platformWorkerApp = createPlatformFactory(platformCore, 'workerApp');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated Use {@link platformWorkerApp} instead
|
||||||
|
*/
|
||||||
|
export const workerAppPlatform = platformWorkerApp;
|
||||||
|
|
||||||
function _exceptionHandler(): ExceptionHandler {
|
function _exceptionHandler(): ExceptionHandler {
|
||||||
return new ExceptionHandler(new PrintLogger());
|
return new ExceptionHandler(new PrintLogger());
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* found in the LICENSE file at https://angular.io/license
|
* found in the LICENSE file at https://angular.io/license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {ExceptionHandler, Injectable, Injector, NgZone, OpaqueToken, PLATFORM_COMMON_PROVIDERS, PLATFORM_INITIALIZER, PlatformRef, ReflectiveInjector, RootRenderer, Testability, assertPlatform, corePlatform, createPlatform, createPlatformFactory, getPlatform, isDevMode} from '@angular/core';
|
import {ExceptionHandler, Injectable, Injector, NgZone, OpaqueToken, PLATFORM_COMMON_PROVIDERS, PLATFORM_INITIALIZER, PlatformRef, ReflectiveInjector, RootRenderer, Testability, assertPlatform, createPlatform, createPlatformFactory, getPlatform, isDevMode, platformCore} from '@angular/core';
|
||||||
|
|
||||||
import {wtfInit} from '../core_private';
|
import {wtfInit} from '../core_private';
|
||||||
|
|
||||||
|
@ -107,8 +107,8 @@ export const _WORKER_UI_PLATFORM_PROVIDERS: Array<any /*Type | Provider | any[]*
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* * @deprecated Use `workerUiPlatform()` or create a custom platform factory via
|
* * @deprecated Use `platformWorkerUi()` or create a custom platform factory via
|
||||||
* `createPlatformFactory(workerUiPlatform, ...)`
|
* `createPlatformFactory(platformWorkerUi, ...)`
|
||||||
*/
|
*/
|
||||||
export const WORKER_UI_PLATFORM_PROVIDERS: Array<any /*Type | Provider | any[]*/> =
|
export const WORKER_UI_PLATFORM_PROVIDERS: Array<any /*Type | Provider | any[]*/> =
|
||||||
[PLATFORM_COMMON_PROVIDERS, _WORKER_UI_PLATFORM_PROVIDERS];
|
[PLATFORM_COMMON_PROVIDERS, _WORKER_UI_PLATFORM_PROVIDERS];
|
||||||
|
@ -155,8 +155,14 @@ function initWebWorkerRenderPlatform(injector: Injector): () => void {
|
||||||
/**
|
/**
|
||||||
* @experimental WebWorker support is currently experimental.
|
* @experimental WebWorker support is currently experimental.
|
||||||
*/
|
*/
|
||||||
export const workerUiPlatform =
|
export const platformWorkerUi =
|
||||||
createPlatformFactory(corePlatform, 'workerUi', _WORKER_UI_PLATFORM_PROVIDERS);
|
createPlatformFactory(platformCore, 'workerUi', _WORKER_UI_PLATFORM_PROVIDERS);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated Use {@link platformWorkerUi} instead
|
||||||
|
*/
|
||||||
|
export const workerUiPlatform = platformWorkerUi;
|
||||||
|
|
||||||
|
|
||||||
function _exceptionHandler(): ExceptionHandler {
|
function _exceptionHandler(): ExceptionHandler {
|
||||||
return new ExceptionHandler(getDOM());
|
return new ExceptionHandler(getDOM());
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
import {LowerCasePipe, NgIf} from '@angular/common';
|
import {LowerCasePipe, NgIf} from '@angular/common';
|
||||||
import {XHR} from '@angular/compiler';
|
import {XHR} from '@angular/compiler';
|
||||||
import {APP_INITIALIZER, createPlatformFactory, CUSTOM_ELEMENTS_SCHEMA, Component, Directive, ExceptionHandler, Inject, Input, NgModule, OnDestroy, PLATFORM_DIRECTIVES, PLATFORM_INITIALIZER, PLATFORM_PIPES, Pipe, ReflectiveInjector, bootstrapModule, createPlatform, provide} from '@angular/core';
|
import {APP_INITIALIZER, CUSTOM_ELEMENTS_SCHEMA, Component, Directive, ExceptionHandler, Inject, Input, NgModule, OnDestroy, PLATFORM_DIRECTIVES, PLATFORM_INITIALIZER, PLATFORM_PIPES, Pipe, ReflectiveInjector, createPlatform, createPlatformFactory, provide} from '@angular/core';
|
||||||
import {ApplicationRef, disposePlatform} from '@angular/core/src/application_ref';
|
import {ApplicationRef, disposePlatform} from '@angular/core/src/application_ref';
|
||||||
import {Console} from '@angular/core/src/console';
|
import {Console} from '@angular/core/src/console';
|
||||||
import {ComponentRef} from '@angular/core/src/linker/component_factory';
|
import {ComponentRef} from '@angular/core/src/linker/component_factory';
|
||||||
|
@ -16,7 +16,7 @@ import {Testability, TestabilityRegistry} from '@angular/core/src/testability/te
|
||||||
import {ComponentFixture} from '@angular/core/testing';
|
import {ComponentFixture} from '@angular/core/testing';
|
||||||
import {AsyncTestCompleter, Log, afterEach, beforeEach, beforeEachProviders, ddescribe, describe, iit, inject, it} from '@angular/core/testing/testing_internal';
|
import {AsyncTestCompleter, Log, afterEach, beforeEach, beforeEachProviders, ddescribe, describe, iit, inject, it} from '@angular/core/testing/testing_internal';
|
||||||
import {BrowserModule} from '@angular/platform-browser';
|
import {BrowserModule} from '@angular/platform-browser';
|
||||||
import {bootstrap, browserDynamicPlatform} from '@angular/platform-browser-dynamic';
|
import {bootstrap, platformBrowserDynamic} from '@angular/platform-browser-dynamic';
|
||||||
import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
|
import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
|
||||||
import {DOCUMENT} from '@angular/platform-browser/src/dom/dom_tokens';
|
import {DOCUMENT} from '@angular/platform-browser/src/dom/dom_tokens';
|
||||||
import {expect} from '@angular/platform-browser/testing/matchers';
|
import {expect} from '@angular/platform-browser/testing/matchers';
|
||||||
|
@ -258,7 +258,7 @@ export function main() {
|
||||||
|
|
||||||
it('should run platform initializers',
|
it('should run platform initializers',
|
||||||
inject([Log, AsyncTestCompleter], (log: Log, async: AsyncTestCompleter) => {
|
inject([Log, AsyncTestCompleter], (log: Log, async: AsyncTestCompleter) => {
|
||||||
let p = createPlatformFactory(browserDynamicPlatform, 'someName', [
|
let p = createPlatformFactory(platformBrowserDynamic, 'someName', [
|
||||||
{provide: PLATFORM_INITIALIZER, useValue: log.fn('platform_init1'), multi: true},
|
{provide: PLATFORM_INITIALIZER, useValue: log.fn('platform_init1'), multi: true},
|
||||||
{provide: PLATFORM_INITIALIZER, useValue: log.fn('platform_init2'), multi: true}
|
{provide: PLATFORM_INITIALIZER, useValue: log.fn('platform_init2'), multi: true}
|
||||||
])();
|
])();
|
||||||
|
@ -275,7 +275,7 @@ export function main() {
|
||||||
|
|
||||||
expect(log.result()).toEqual('platform_init1; platform_init2');
|
expect(log.result()).toEqual('platform_init1; platform_init2');
|
||||||
log.clear();
|
log.clear();
|
||||||
bootstrapModule(SomeModule, p).then(() => {
|
p.bootstrapModule(SomeModule).then(() => {
|
||||||
expect(log.result()).toEqual('app_init1; app_init2');
|
expect(log.result()).toEqual('app_init1; app_init2');
|
||||||
async.done();
|
async.done();
|
||||||
});
|
});
|
||||||
|
|
|
@ -285,7 +285,7 @@ export function main() {
|
||||||
class ComponentUsingInvalidProperty {
|
class ComponentUsingInvalidProperty {
|
||||||
}
|
}
|
||||||
|
|
||||||
tcb.createSync(ComponentUsingInvalidProperty)
|
tcb.createSync(ComponentUsingInvalidProperty);
|
||||||
expect(() => tcb.createSync(ComponentUsingInvalidProperty)).not.toThrow();
|
expect(() => tcb.createSync(ComponentUsingInvalidProperty)).not.toThrow();
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
|
|
|
@ -24,7 +24,7 @@ import {createPairedMessageBuses, PairedMessageBuses} from '../shared/web_worker
|
||||||
import {ServiceMessageBrokerFactory_} from '@angular/platform-browser/src/web_workers/shared/service_message_broker';
|
import {ServiceMessageBrokerFactory_} from '@angular/platform-browser/src/web_workers/shared/service_message_broker';
|
||||||
import {dispatchEvent} from '../../../../platform-browser/testing/browser_util';
|
import {dispatchEvent} from '../../../../platform-browser/testing/browser_util';
|
||||||
import {BrowserTestingModule} from '@angular/platform-browser/testing';
|
import {BrowserTestingModule} from '@angular/platform-browser/testing';
|
||||||
import {browserDynamicTestingPlatform} from '@angular/platform-browser-dynamic/testing';
|
import {platformBrowserDynamicTesting} from '@angular/platform-browser-dynamic/testing';
|
||||||
|
|
||||||
export function main() {
|
export function main() {
|
||||||
function createWebWorkerBrokerFactory(
|
function createWebWorkerBrokerFactory(
|
||||||
|
@ -65,7 +65,7 @@ export function main() {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
uiRenderStore = new RenderStore();
|
uiRenderStore = new RenderStore();
|
||||||
var testUiInjector = new TestBed();
|
var testUiInjector = new TestBed();
|
||||||
testUiInjector.platform = browserDynamicTestingPlatform();
|
testUiInjector.platform = platformBrowserDynamicTesting();
|
||||||
testUiInjector.ngModule = BrowserTestingModule;
|
testUiInjector.ngModule = BrowserTestingModule;
|
||||||
testUiInjector.configureModule({
|
testUiInjector.configureModule({
|
||||||
providers: [
|
providers: [
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {LocationStrategy} from '@angular/common';
|
import {LocationStrategy} from '@angular/common';
|
||||||
import {APP_ID, NgModule, NgZone, OpaqueToken, PLATFORM_COMMON_PROVIDERS, PLATFORM_INITIALIZER, PlatformRef, ReflectiveInjector, assertPlatform, corePlatform, createPlatform, createPlatformFactory, getPlatform} from '@angular/core';
|
import {APP_ID, NgModule, NgZone, OpaqueToken, PLATFORM_COMMON_PROVIDERS, PLATFORM_INITIALIZER, PlatformRef, ReflectiveInjector, assertPlatform, createPlatform, createPlatformFactory, getPlatform, platformCore} from '@angular/core';
|
||||||
|
|
||||||
import {BrowserModule} from '../src/browser';
|
import {BrowserModule} from '../src/browser';
|
||||||
import {BrowserDomAdapter} from '../src/browser/browser_adapter';
|
import {BrowserDomAdapter} from '../src/browser/browser_adapter';
|
||||||
|
@ -31,8 +31,8 @@ const _TEST_BROWSER_PLATFORM_PROVIDERS: Array<any /*Type | Provider | any[]*/> =
|
||||||
/**
|
/**
|
||||||
* Providers for the browser test platform
|
* Providers for the browser test platform
|
||||||
*
|
*
|
||||||
* @deprecated Use `browserTestingPlatform()` or create a custom platform factory via
|
* @deprecated Use `platformBrowserTesting()` or create a custom platform factory via
|
||||||
* `createPlatformFactory(browserTestingPlatform, ...)`
|
* `createPlatformFactory(platformBrowserTesting, ...)`
|
||||||
*/
|
*/
|
||||||
export const TEST_BROWSER_PLATFORM_PROVIDERS: Array<any /*Type | Provider | any[]*/> =
|
export const TEST_BROWSER_PLATFORM_PROVIDERS: Array<any /*Type | Provider | any[]*/> =
|
||||||
[PLATFORM_COMMON_PROVIDERS, _TEST_BROWSER_PLATFORM_PROVIDERS];
|
[PLATFORM_COMMON_PROVIDERS, _TEST_BROWSER_PLATFORM_PROVIDERS];
|
||||||
|
@ -50,8 +50,13 @@ export const TEST_BROWSER_APPLICATION_PROVIDERS: Array<any /*Type | Provider | a
|
||||||
*
|
*
|
||||||
* @experimental API related to bootstrapping are still under review.
|
* @experimental API related to bootstrapping are still under review.
|
||||||
*/
|
*/
|
||||||
export const browserTestingPlatform =
|
export const platformBrowserTesting =
|
||||||
createPlatformFactory(corePlatform, 'browserTesting', _TEST_BROWSER_PLATFORM_PROVIDERS);
|
createPlatformFactory(platformCore, 'browserTesting', _TEST_BROWSER_PLATFORM_PROVIDERS);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated Use {@link platformBrowserTesting} instead
|
||||||
|
*/
|
||||||
|
export const browserTestingPlatform = platformBrowserTesting;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* NgModule for testing.
|
* NgModule for testing.
|
||||||
|
|
|
@ -6,4 +6,4 @@
|
||||||
* found in the LICENSE file at https://angular.io/license
|
* found in the LICENSE file at https://angular.io/license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export {SERVER_PLATFORM_PROVIDERS, serverBootstrap, serverDynamicPlatform, serverPlatform} from './src/server';
|
export {SERVER_PLATFORM_PROVIDERS, platformDynamicServer, platformServer, serverBootstrap} from './src/server';
|
||||||
|
|
|
@ -7,8 +7,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {PlatformLocation} from '@angular/common';
|
import {PlatformLocation} from '@angular/common';
|
||||||
import {analyzeAppProvidersForDeprecatedConfiguration, coreDynamicPlatform} from '@angular/compiler';
|
import {analyzeAppProvidersForDeprecatedConfiguration, platformCoreDynamic} from '@angular/compiler';
|
||||||
import {ApplicationRef, CompilerFactory, ComponentRef, NgModule, OpaqueToken, PLATFORM_COMMON_PROVIDERS, PLATFORM_INITIALIZER, PlatformRef, ReflectiveInjector, Type, assertPlatform, bootstrapModule, corePlatform, createPlatform, createPlatformFactory, getPlatform} from '@angular/core';
|
import {ApplicationRef, CompilerFactory, ComponentRef, NgModule, OpaqueToken, PLATFORM_COMMON_PROVIDERS, PLATFORM_INITIALIZER, PlatformRef, ReflectiveInjector, Type, assertPlatform, createPlatform, createPlatformFactory, getPlatform, platformCore} from '@angular/core';
|
||||||
import {BrowserModule} from '@angular/platform-browser';
|
import {BrowserModule} from '@angular/platform-browser';
|
||||||
|
|
||||||
import {Console, ReflectionCapabilities, reflector, wtfInit} from '../core_private';
|
import {Console, ReflectionCapabilities, reflector, wtfInit} from '../core_private';
|
||||||
|
@ -43,8 +43,8 @@ export const INTERNAL_SERVER_PLATFORM_PROVIDERS: Array<any /*Type | Provider | a
|
||||||
* A set of providers to initialize the Angular platform in a server.
|
* A set of providers to initialize the Angular platform in a server.
|
||||||
*
|
*
|
||||||
* Used automatically by `serverBootstrap`, or can be passed to `platform`.
|
* Used automatically by `serverBootstrap`, or can be passed to `platform`.
|
||||||
* @deprecated Use `serverPlatform()` or create a custom platform factory via
|
* @deprecated Use `platformServer()` or create a custom platform factory via
|
||||||
* `createPlatformFactory(serverPlatform, ...)`
|
* `createPlatformFactory(platformServer, ...)`
|
||||||
*/
|
*/
|
||||||
export const SERVER_PLATFORM_PROVIDERS: Array<any /*Type | Provider | any[]*/> =
|
export const SERVER_PLATFORM_PROVIDERS: Array<any /*Type | Provider | any[]*/> =
|
||||||
[PLATFORM_COMMON_PROVIDERS, INTERNAL_SERVER_PLATFORM_PROVIDERS];
|
[PLATFORM_COMMON_PROVIDERS, INTERNAL_SERVER_PLATFORM_PROVIDERS];
|
||||||
|
@ -57,16 +57,26 @@ function initParse5Adapter() {
|
||||||
/**
|
/**
|
||||||
* @experimental
|
* @experimental
|
||||||
*/
|
*/
|
||||||
export const serverPlatform =
|
export const platformServer =
|
||||||
createPlatformFactory(corePlatform, 'server', INTERNAL_SERVER_PLATFORM_PROVIDERS);
|
createPlatformFactory(platformCore, 'server', INTERNAL_SERVER_PLATFORM_PROVIDERS);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated Use {@link platformServer} instead
|
||||||
|
*/
|
||||||
|
export const serverPlatform = platformServer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The server platform that supports the runtime compiler.
|
* The server platform that supports the runtime compiler.
|
||||||
*
|
*
|
||||||
* @experimental
|
* @experimental
|
||||||
*/
|
*/
|
||||||
export const serverDynamicPlatform =
|
export const platformDynamicServer =
|
||||||
createPlatformFactory(coreDynamicPlatform, 'serverDynamic', INTERNAL_SERVER_PLATFORM_PROVIDERS);
|
createPlatformFactory(platformCoreDynamic, 'serverDynamic', INTERNAL_SERVER_PLATFORM_PROVIDERS);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated Use {@link platformDynamicServer} instead
|
||||||
|
*/
|
||||||
|
export const serverDynamicPlatform = platformDynamicServer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to bootstrap Angular in server environment (such as node).
|
* Used to bootstrap Angular in server environment (such as node).
|
||||||
|
@ -105,8 +115,8 @@ export function serverBootstrap<T>(
|
||||||
class DynamicModule {
|
class DynamicModule {
|
||||||
}
|
}
|
||||||
|
|
||||||
return bootstrapModule(
|
return platformDynamicServer()
|
||||||
DynamicModule, serverDynamicPlatform(), deprecatedConfiguration.compilerOptions)
|
.bootstrapModule(DynamicModule, deprecatedConfiguration.compilerOptions)
|
||||||
.then((moduleRef) => {
|
.then((moduleRef) => {
|
||||||
const console = moduleRef.injector.get(Console);
|
const console = moduleRef.injector.get(Console);
|
||||||
deprecatedConfiguration.deprecationMessages.forEach((msg) => console.warn(msg));
|
deprecatedConfiguration.deprecationMessages.forEach((msg) => console.warn(msg));
|
||||||
|
|
|
@ -7,13 +7,13 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {analyzeAppProvidersForDeprecatedConfiguration} from '@angular/compiler';
|
import {analyzeAppProvidersForDeprecatedConfiguration} from '@angular/compiler';
|
||||||
import {coreDynamicTestingPlatform} from '@angular/compiler/testing';
|
import {platformCoreDynamicTesting} from '@angular/compiler/testing';
|
||||||
import {CompilerFactory, CompilerOptions, NgModule, OpaqueToken, PLATFORM_COMMON_PROVIDERS, PLATFORM_INITIALIZER, PlatformRef, ReflectiveInjector, assertPlatform, createPlatform, createPlatformFactory, getPlatform} from '@angular/core';
|
import {CompilerFactory, CompilerOptions, NgModule, OpaqueToken, PLATFORM_COMMON_PROVIDERS, PLATFORM_INITIALIZER, PlatformRef, ReflectiveInjector, assertPlatform, createPlatform, createPlatformFactory, getPlatform} from '@angular/core';
|
||||||
import {initTestEnvironment} from '@angular/core/testing';
|
import {initTestEnvironment} from '@angular/core/testing';
|
||||||
import {BrowserDynamicTestingModule, TEST_BROWSER_DYNAMIC_APPLICATION_PROVIDERS, browserDynamicTestingPlatform} from '@angular/platform-browser-dynamic/testing';
|
import {BrowserDynamicTestingModule, TEST_BROWSER_DYNAMIC_APPLICATION_PROVIDERS, platformBrowserDynamicTesting} from '@angular/platform-browser-dynamic/testing';
|
||||||
|
|
||||||
import {Console} from '../core_private';
|
import {Console} from '../core_private';
|
||||||
import {serverPlatform} from '../index';
|
import {platformServer} from '../index';
|
||||||
import {Parse5DomAdapter} from '../src/parse5_adapter';
|
import {Parse5DomAdapter} from '../src/parse5_adapter';
|
||||||
import {INTERNAL_SERVER_PLATFORM_PROVIDERS} from '../src/server';
|
import {INTERNAL_SERVER_PLATFORM_PROVIDERS} from '../src/server';
|
||||||
|
|
||||||
|
@ -22,8 +22,13 @@ import {INTERNAL_SERVER_PLATFORM_PROVIDERS} from '../src/server';
|
||||||
*
|
*
|
||||||
* @experimental API related to bootstrapping are still under review.
|
* @experimental API related to bootstrapping are still under review.
|
||||||
*/
|
*/
|
||||||
export const serverTestingPlatform = createPlatformFactory(
|
export const platformServerTesting = createPlatformFactory(
|
||||||
coreDynamicTestingPlatform, 'serverTesting', INTERNAL_SERVER_PLATFORM_PROVIDERS);
|
platformCoreDynamicTesting, 'serverTesting', INTERNAL_SERVER_PLATFORM_PROVIDERS);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated Use {@link platformServerTesting} instead
|
||||||
|
*/
|
||||||
|
export const serverTestingPlatform = platformServerTesting;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* NgModule for testing.
|
* NgModule for testing.
|
||||||
|
@ -37,15 +42,15 @@ export class ServerTestingModule {
|
||||||
/**
|
/**
|
||||||
* Providers of the `serverTestingPlatform` to be used for creating own platform based on this.
|
* Providers of the `serverTestingPlatform` to be used for creating own platform based on this.
|
||||||
*
|
*
|
||||||
* @deprecated Use `serverTestingPlatform()` or create a custom platform factory via
|
* @deprecated Use `platformServerTesting()` or create a custom platform factory via
|
||||||
* `createPlatformFactory(serverTestingPlatform, ...)`
|
* `createPlatformFactory(platformServerTesting, ...)`
|
||||||
*/
|
*/
|
||||||
export const TEST_SERVER_PLATFORM_PROVIDERS: Array<any /*Type | Provider | any[]*/> =
|
export const TEST_SERVER_PLATFORM_PROVIDERS: Array<any /*Type | Provider | any[]*/> =
|
||||||
// Note: This is not a real provider but a hack to still support the deprecated
|
// Note: This is not a real provider but a hack to still support the deprecated
|
||||||
// `setBaseTestProviders` method!
|
// `setBaseTestProviders` method!
|
||||||
[(appProviders: any[]) => {
|
[(appProviders: any[]) => {
|
||||||
const deprecatedConfiguration = analyzeAppProvidersForDeprecatedConfiguration(appProviders);
|
const deprecatedConfiguration = analyzeAppProvidersForDeprecatedConfiguration(appProviders);
|
||||||
const platformRef = createPlatformFactory(serverTestingPlatform, 'serverTestingDeprecated', [{
|
const platformRef = createPlatformFactory(platformServerTesting, 'serverTestingDeprecated', [{
|
||||||
provide: CompilerOptions,
|
provide: CompilerOptions,
|
||||||
useValue: deprecatedConfiguration.compilerOptions,
|
useValue: deprecatedConfiguration.compilerOptions,
|
||||||
multi: true
|
multi: true
|
||||||
|
|
|
@ -6,9 +6,9 @@
|
||||||
* found in the LICENSE file at https://angular.io/license
|
* found in the LICENSE file at https://angular.io/license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {ApplicationRef, Compiler, CompilerFactory, ComponentFactory, ComponentResolver, Injector, NgModule, NgZone, PlatformRef, Provider, ReflectiveInjector, Testability, Type, bootstrapModuleFactory, provide} from '@angular/core';
|
import {ApplicationRef, Compiler, CompilerFactory, ComponentFactory, ComponentResolver, Injector, NgModule, NgZone, PlatformRef, Provider, ReflectiveInjector, Testability, Type, provide} from '@angular/core';
|
||||||
import {BrowserModule} from '@angular/platform-browser';
|
import {BrowserModule} from '@angular/platform-browser';
|
||||||
import {browserDynamicPlatform} from '@angular/platform-browser-dynamic';
|
import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';
|
||||||
|
|
||||||
import * as angular from './angular_js';
|
import * as angular from './angular_js';
|
||||||
import {NG1_COMPILE, NG1_INJECTOR, NG1_PARSE, NG1_ROOT_SCOPE, NG1_TESTABILITY, NG2_COMPILER, NG2_COMPONENT_FACTORY_REF_MAP, NG2_INJECTOR, NG2_ZONE, REQUIRE_INJECTOR} from './constants';
|
import {NG1_COMPILE, NG1_INJECTOR, NG1_PARSE, NG1_ROOT_SCOPE, NG1_TESTABILITY, NG2_COMPILER, NG2_COMPONENT_FACTORY_REF_MAP, NG2_INJECTOR, NG2_ZONE, REQUIRE_INJECTOR} from './constants';
|
||||||
|
@ -278,7 +278,7 @@ export class UpgradeAdapter {
|
||||||
UpgradeAdapterRef {
|
UpgradeAdapterRef {
|
||||||
var upgrade = new UpgradeAdapterRef();
|
var upgrade = new UpgradeAdapterRef();
|
||||||
var ng1Injector: angular.IInjectorService = null;
|
var ng1Injector: angular.IInjectorService = null;
|
||||||
var platformRef: PlatformRef = browserDynamicPlatform();
|
var platformRef: PlatformRef = platformBrowserDynamic();
|
||||||
var providers = [
|
var providers = [
|
||||||
{provide: NG1_INJECTOR, useFactory: () => ng1Injector},
|
{provide: NG1_INJECTOR, useFactory: () => ng1Injector},
|
||||||
{provide: NG1_COMPILE, useFactory: () => ng1Injector.get(NG1_COMPILE)}, this.providers
|
{provide: NG1_COMPILE, useFactory: () => ng1Injector.get(NG1_COMPILE)}, this.providers
|
||||||
|
@ -289,8 +289,8 @@ export class UpgradeAdapter {
|
||||||
}
|
}
|
||||||
|
|
||||||
const compilerFactory: CompilerFactory = platformRef.injector.get(CompilerFactory);
|
const compilerFactory: CompilerFactory = platformRef.injector.get(CompilerFactory);
|
||||||
var moduleRef = bootstrapModuleFactory(
|
var moduleRef = platformRef.bootstrapModuleFactory(
|
||||||
compilerFactory.createCompiler().compileModuleSync(DynamicModule), platformRef);
|
compilerFactory.createCompiler().compileModuleSync(DynamicModule));
|
||||||
const boundCompiler: Compiler = moduleRef.injector.get(Compiler);
|
const boundCompiler: Compiler = moduleRef.injector.get(Compiler);
|
||||||
var applicationRef: ApplicationRef = moduleRef.injector.get(ApplicationRef);
|
var applicationRef: ApplicationRef = moduleRef.injector.get(ApplicationRef);
|
||||||
var injector: Injector = applicationRef.injector;
|
var injector: Injector = applicationRef.injector;
|
||||||
|
|
|
@ -6,11 +6,10 @@
|
||||||
* found in the LICENSE file at https://angular.io/license
|
* found in the LICENSE file at https://angular.io/license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {workerAppDynamicPlatform} from '@angular/platform-browser-dynamic';
|
import {platformWorkerAppDynamic} from '@angular/platform-browser-dynamic';
|
||||||
import {bootstrapModule} from '@angular/core';
|
|
||||||
|
|
||||||
import {AppModule} from './index_common';
|
import {AppModule} from './index_common';
|
||||||
|
|
||||||
export function main() {
|
export function main() {
|
||||||
bootstrapModule(AppModule, workerAppDynamicPlatform());
|
platformWorkerAppDynamic().bootstrapModule(AppModule);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue