feat(browser): use AppModules for bootstrap in the browser
This introduces the `BrowserModule` to be used for long form
bootstrap and offline compile bootstrap:
```
@AppModule({
modules: [BrowserModule],
precompile: [MainComponent],
providers: […], // additional providers
directives: […], // additional platform directives
pipes: […] // additional platform pipes
})
class MyModule {
constructor(appRef: ApplicationRef) {
appRef.bootstrap(MainComponent);
}
}
// offline compile
import {bootstrapModuleFactory} from ‘@angular/platform-browser’;
bootstrapModuleFactory(MyModuleNgFactory);
// runtime compile long form
import {bootstrapModule} from ‘@angular/platform-browser-dynamic’;
bootstrapModule(MyModule);
```
The short form, `bootstrap(...)`, can now creates a module on the fly,
given `directives`, `pipes, `providers`, `precompile` and `modules`
properties.
Related changes:
- make `SanitizationService`, `SecurityContext` public in `@angular/core` so that the offline compiler can resolve the token
- move `AnimationDriver` to `platform-browser` and make it
public so that the offline compiler can resolve the token
BREAKING CHANGES:
- short form bootstrap does no longer allow
to inject compiler internals (i.e. everything
from `@angular/compiler). Inject `Compiler` instead.
To provide custom providers for the compiler,
create a custom compiler via `browserCompiler({providers: [...]})`
and pass that into the `bootstrap` method.
2016-06-30 16:07:17 -04:00
|
|
|
/** @experimental */
|
|
|
|
export declare abstract class AnimationDriver {
|
|
|
|
abstract animate(element: any, startingStyles: AnimationStyles, keyframes: AnimationKeyframe[], duration: number, delay: number, easing: string): AnimationPlayer;
|
|
|
|
static NOOP: AnimationDriver;
|
|
|
|
}
|
|
|
|
|
2016-06-27 15:27:23 -04:00
|
|
|
/** @experimental */
|
2016-06-22 17:56:10 -04:00
|
|
|
export declare const BROWSER_APP_PROVIDERS: Array<any>;
|
|
|
|
|
2016-06-27 15:27:23 -04:00
|
|
|
/** @experimental */
|
2016-06-22 17:56:10 -04:00
|
|
|
export declare const BROWSER_PLATFORM_PROVIDERS: Array<any>;
|
|
|
|
|
2016-06-27 15:27:23 -04:00
|
|
|
/** @experimental */
|
2016-06-22 17:56:10 -04:00
|
|
|
export declare const BROWSER_SANITIZATION_PROVIDERS: Array<any>;
|
|
|
|
|
refactor(core): clean up platform bootstrap and initTestEnvironment
- Introduces `CompilerFactory` which can be part of a `PlatformRef`.
- Introduces `WorkerAppModule`, `WorkerUiModule`, `ServerModule`
- Introduces `serverDynamicPlatform` for applications using runtime compilation
on the server.
- Changes browser bootstrap for runtime and offline compilation (see below for an example).
* introduces `bootstrapModule` and `bootstrapModuleFactory` in `@angular/core`
* introduces new `browserDynamicPlatform` in `@angular/platform-browser-dynamic
- Changes `initTestEnvironment` (which used to be `setBaseTestProviders`) to not take a compiler factory any more (see below for an example).
BREAKING CHANGE:
## Migration from `setBaseTestProviders` to `initTestEnvironment`:
- For the browser platform:
BEFORE:
```
import {setBaseTestProviders} from ‘@angular/core/testing’;
import {TEST_BROWSER_DYNAMIC_PLATFORM_PROVIDERS,
TEST_BROWSER_DYNAMIC_APPLICATION_PROVIDERS} from ‘@angular/platform-browser-dynamic/testing’;
setBaseTestProviders(TEST_BROWSER_DYNAMIC_PLATFORM_PROVIDERS,
TEST_BROWSER_DYNAMIC_APPLICATION_PROVIDERS);
```
AFTER:
```
import {initTestEnvironment} from ‘@angular/core/testing’;
import {browserDynamicTestPlatform,
BrowserDynamicTestModule} from ‘@angular/platform-browser-dynamic/testing’;
initTestEnvironment(
BrowserDynamicTestModule,
browserDynamicTestPlatform());
```
- For the server platform:
BEFORE:
```
import {setBaseTestProviders} from ‘@angular/core/testing’;
import {TEST_SERVER_PLATFORM_PROVIDERS,
TEST_SERVER_APPLICATION_PROVIDERS} from ‘@angular/platform-server/testing/server’;
setBaseTestProviders(TEST_SERVER_PLATFORM_PROVIDERS,
TEST_SERVER_APPLICATION_PROVIDERS);
```
AFTER:
```
import {initTestEnvironment} from ‘@angular/core/testing’;
import {serverTestPlatform,
ServerTestModule} from ‘@angular/platform-browser-dynamic/testing’;
initTestEnvironment(
ServerTestModule,
serverTestPlatform());
```
## Bootstrap changes
```
@AppModule({
modules: [BrowserModule],
precompile: [MainComponent],
providers: […], // additional providers
directives: […], // additional platform directives
pipes: […] // additional platform pipes
})
class MyModule {
constructor(appRef: ApplicationRef) {
appRef.bootstrap(MainComponent);
}
}
// offline compile
import {browserPlatform} from ‘@angular/platform-browser’;
import {bootstrapModuleFactory} from ‘@angular/core’;
bootstrapModuleFactory(MyModuleNgFactory, browserPlatform());
// runtime compile long form
import {browserDynamicPlatform} from ‘@angular/platform-browser-dynamic’;
import {bootstrapModule} from ‘@angular/core’;
bootstrapModule(MyModule, browserDynamicPlatform());
```
Closes #9922
Part of #9726
2016-07-08 13:47:17 -04:00
|
|
|
/** @experimental */
|
feat(browser): use AppModules for bootstrap in the browser
This introduces the `BrowserModule` to be used for long form
bootstrap and offline compile bootstrap:
```
@AppModule({
modules: [BrowserModule],
precompile: [MainComponent],
providers: […], // additional providers
directives: […], // additional platform directives
pipes: […] // additional platform pipes
})
class MyModule {
constructor(appRef: ApplicationRef) {
appRef.bootstrap(MainComponent);
}
}
// offline compile
import {bootstrapModuleFactory} from ‘@angular/platform-browser’;
bootstrapModuleFactory(MyModuleNgFactory);
// runtime compile long form
import {bootstrapModule} from ‘@angular/platform-browser-dynamic’;
bootstrapModule(MyModule);
```
The short form, `bootstrap(...)`, can now creates a module on the fly,
given `directives`, `pipes, `providers`, `precompile` and `modules`
properties.
Related changes:
- make `SanitizationService`, `SecurityContext` public in `@angular/core` so that the offline compiler can resolve the token
- move `AnimationDriver` to `platform-browser` and make it
public so that the offline compiler can resolve the token
BREAKING CHANGES:
- short form bootstrap does no longer allow
to inject compiler internals (i.e. everything
from `@angular/compiler). Inject `Compiler` instead.
To provide custom providers for the compiler,
create a custom compiler via `browserCompiler({providers: [...]})`
and pass that into the `bootstrap` method.
2016-06-30 16:07:17 -04:00
|
|
|
export declare class BrowserModule {
|
|
|
|
}
|
|
|
|
|
2016-06-27 15:27:23 -04:00
|
|
|
/** @experimental */
|
refactor(core): clean up platform bootstrap and initTestEnvironment
- Introduces `CompilerFactory` which can be part of a `PlatformRef`.
- Introduces `WorkerAppModule`, `WorkerUiModule`, `ServerModule`
- Introduces `serverDynamicPlatform` for applications using runtime compilation
on the server.
- Changes browser bootstrap for runtime and offline compilation (see below for an example).
* introduces `bootstrapModule` and `bootstrapModuleFactory` in `@angular/core`
* introduces new `browserDynamicPlatform` in `@angular/platform-browser-dynamic
- Changes `initTestEnvironment` (which used to be `setBaseTestProviders`) to not take a compiler factory any more (see below for an example).
BREAKING CHANGE:
## Migration from `setBaseTestProviders` to `initTestEnvironment`:
- For the browser platform:
BEFORE:
```
import {setBaseTestProviders} from ‘@angular/core/testing’;
import {TEST_BROWSER_DYNAMIC_PLATFORM_PROVIDERS,
TEST_BROWSER_DYNAMIC_APPLICATION_PROVIDERS} from ‘@angular/platform-browser-dynamic/testing’;
setBaseTestProviders(TEST_BROWSER_DYNAMIC_PLATFORM_PROVIDERS,
TEST_BROWSER_DYNAMIC_APPLICATION_PROVIDERS);
```
AFTER:
```
import {initTestEnvironment} from ‘@angular/core/testing’;
import {browserDynamicTestPlatform,
BrowserDynamicTestModule} from ‘@angular/platform-browser-dynamic/testing’;
initTestEnvironment(
BrowserDynamicTestModule,
browserDynamicTestPlatform());
```
- For the server platform:
BEFORE:
```
import {setBaseTestProviders} from ‘@angular/core/testing’;
import {TEST_SERVER_PLATFORM_PROVIDERS,
TEST_SERVER_APPLICATION_PROVIDERS} from ‘@angular/platform-server/testing/server’;
setBaseTestProviders(TEST_SERVER_PLATFORM_PROVIDERS,
TEST_SERVER_APPLICATION_PROVIDERS);
```
AFTER:
```
import {initTestEnvironment} from ‘@angular/core/testing’;
import {serverTestPlatform,
ServerTestModule} from ‘@angular/platform-browser-dynamic/testing’;
initTestEnvironment(
ServerTestModule,
serverTestPlatform());
```
## Bootstrap changes
```
@AppModule({
modules: [BrowserModule],
precompile: [MainComponent],
providers: […], // additional providers
directives: […], // additional platform directives
pipes: […] // additional platform pipes
})
class MyModule {
constructor(appRef: ApplicationRef) {
appRef.bootstrap(MainComponent);
}
}
// offline compile
import {browserPlatform} from ‘@angular/platform-browser’;
import {bootstrapModuleFactory} from ‘@angular/core’;
bootstrapModuleFactory(MyModuleNgFactory, browserPlatform());
// runtime compile long form
import {browserDynamicPlatform} from ‘@angular/platform-browser-dynamic’;
import {bootstrapModule} from ‘@angular/core’;
bootstrapModule(MyModule, browserDynamicPlatform());
```
Closes #9922
Part of #9726
2016-07-08 13:47:17 -04:00
|
|
|
export declare const browserPlatform: () => PlatformRef;
|
2016-06-22 17:56:10 -04:00
|
|
|
|
2016-06-27 15:27:23 -04:00
|
|
|
/** @stable */
|
2016-06-22 17:56:10 -04:00
|
|
|
export declare class BrowserPlatformLocation extends PlatformLocation {
|
2016-06-23 21:19:32 -04:00
|
|
|
hash: string;
|
|
|
|
pathname: string;
|
|
|
|
search: string;
|
2016-06-22 17:56:10 -04:00
|
|
|
constructor();
|
2016-06-23 21:19:32 -04:00
|
|
|
back(): void;
|
|
|
|
forward(): void;
|
2016-06-22 17:56:10 -04:00
|
|
|
getBaseHrefFromDOM(): string;
|
|
|
|
onHashChange(fn: UrlChangeListener): void;
|
2016-06-23 21:19:32 -04:00
|
|
|
onPopState(fn: UrlChangeListener): void;
|
2016-06-22 17:56:10 -04:00
|
|
|
pushState(state: any, title: string, url: string): void;
|
|
|
|
replaceState(state: any, title: string, url: string): void;
|
|
|
|
}
|
|
|
|
|
2016-06-27 15:27:23 -04:00
|
|
|
/** @experimental */
|
2016-06-22 17:56:10 -04:00
|
|
|
export declare class By {
|
|
|
|
static all(): Predicate<DebugElement>;
|
|
|
|
static css(selector: string): Predicate<DebugElement>;
|
|
|
|
static directive(type: Type): Predicate<DebugElement>;
|
|
|
|
}
|
|
|
|
|
2016-06-27 13:02:02 -04:00
|
|
|
/** @experimental */
|
2016-06-22 17:56:10 -04:00
|
|
|
export declare abstract class ClientMessageBroker {
|
|
|
|
abstract runOnService(args: UiArguments, returnType: Type): Promise<any>;
|
|
|
|
}
|
|
|
|
|
2016-06-27 13:02:02 -04:00
|
|
|
/** @experimental */
|
2016-06-22 17:56:10 -04:00
|
|
|
export declare abstract class ClientMessageBrokerFactory {
|
|
|
|
abstract createMessageBroker(channel: string, runInZone?: boolean): ClientMessageBroker;
|
|
|
|
}
|
|
|
|
|
2016-06-27 15:27:23 -04:00
|
|
|
/** @experimental */
|
2016-06-22 17:56:10 -04:00
|
|
|
export declare function disableDebugTools(): void;
|
|
|
|
|
2016-06-27 15:27:23 -04:00
|
|
|
/** @stable */
|
2016-06-22 17:56:10 -04:00
|
|
|
export declare const DOCUMENT: OpaqueToken;
|
|
|
|
|
2016-06-27 15:27:23 -04:00
|
|
|
/** @stable */
|
2016-06-22 17:56:10 -04:00
|
|
|
export declare abstract class DomSanitizationService implements SanitizationService {
|
|
|
|
abstract bypassSecurityTrustHtml(value: string): SafeHtml;
|
2016-06-23 21:19:32 -04:00
|
|
|
abstract bypassSecurityTrustResourceUrl(value: string): SafeResourceUrl;
|
2016-06-22 17:56:10 -04:00
|
|
|
abstract bypassSecurityTrustScript(value: string): SafeScript;
|
2016-06-23 21:19:32 -04:00
|
|
|
abstract bypassSecurityTrustStyle(value: string): SafeStyle;
|
2016-06-22 17:56:10 -04:00
|
|
|
abstract bypassSecurityTrustUrl(value: string): SafeUrl;
|
2016-06-23 21:19:32 -04:00
|
|
|
abstract sanitize(context: SecurityContext, value: any): string;
|
2016-06-22 17:56:10 -04:00
|
|
|
}
|
|
|
|
|
2016-06-27 15:27:23 -04:00
|
|
|
/** @experimental */
|
2016-06-22 17:56:10 -04:00
|
|
|
export declare function enableDebugTools<T>(ref: ComponentRef<T>): ComponentRef<T>;
|
|
|
|
|
2016-06-27 15:27:23 -04:00
|
|
|
/** @stable */
|
2016-06-22 17:56:10 -04:00
|
|
|
export declare const EVENT_MANAGER_PLUGINS: OpaqueToken;
|
|
|
|
|
2016-06-27 15:27:23 -04:00
|
|
|
/** @stable */
|
2016-06-22 17:56:10 -04:00
|
|
|
export declare class EventManager {
|
|
|
|
constructor(plugins: EventManagerPlugin[], _zone: NgZone);
|
|
|
|
addEventListener(element: HTMLElement, eventName: string, handler: Function): Function;
|
|
|
|
addGlobalEventListener(target: string, eventName: string, handler: Function): Function;
|
|
|
|
getZone(): NgZone;
|
|
|
|
}
|
|
|
|
|
2016-06-27 13:02:02 -04:00
|
|
|
/** @experimental */
|
2016-06-22 17:56:10 -04:00
|
|
|
export declare class FnArg {
|
|
|
|
type: Type;
|
2016-06-23 21:19:32 -04:00
|
|
|
value: any;
|
2016-06-22 17:56:10 -04:00
|
|
|
constructor(value: any, type: Type);
|
|
|
|
}
|
|
|
|
|
2016-06-27 15:27:23 -04:00
|
|
|
/** @experimental */
|
2016-06-22 17:56:10 -04:00
|
|
|
export declare const HAMMER_GESTURE_CONFIG: OpaqueToken;
|
|
|
|
|
2016-06-27 15:27:23 -04:00
|
|
|
/** @experimental */
|
2016-06-22 17:56:10 -04:00
|
|
|
export declare class HammerGestureConfig {
|
|
|
|
events: string[];
|
|
|
|
overrides: {
|
|
|
|
[key: string]: Object;
|
|
|
|
};
|
|
|
|
buildHammer(element: HTMLElement): HammerInstance;
|
|
|
|
}
|
|
|
|
|
2016-06-27 13:02:02 -04:00
|
|
|
/** @experimental */
|
2016-06-22 17:56:10 -04:00
|
|
|
export declare abstract class MessageBus implements MessageBusSource, MessageBusSink {
|
|
|
|
abstract attachToZone(zone: NgZone): void;
|
|
|
|
abstract from(channel: string): EventEmitter<any>;
|
2016-06-23 21:19:32 -04:00
|
|
|
abstract initChannel(channel: string, runInZone?: boolean): void;
|
2016-06-22 17:56:10 -04:00
|
|
|
abstract to(channel: string): EventEmitter<any>;
|
|
|
|
}
|
|
|
|
|
2016-06-27 13:02:02 -04:00
|
|
|
/** @experimental */
|
2016-06-22 17:56:10 -04:00
|
|
|
export interface MessageBusSink {
|
|
|
|
attachToZone(zone: NgZone): void;
|
2016-06-23 21:19:32 -04:00
|
|
|
initChannel(channel: string, runInZone: boolean): void;
|
2016-06-22 17:56:10 -04:00
|
|
|
to(channel: string): EventEmitter<any>;
|
|
|
|
}
|
|
|
|
|
2016-06-27 13:02:02 -04:00
|
|
|
/** @experimental */
|
2016-06-22 17:56:10 -04:00
|
|
|
export interface MessageBusSource {
|
|
|
|
attachToZone(zone: NgZone): void;
|
|
|
|
from(channel: string): EventEmitter<any>;
|
2016-06-23 21:19:32 -04:00
|
|
|
initChannel(channel: string, runInZone: boolean): void;
|
2016-06-22 17:56:10 -04:00
|
|
|
}
|
|
|
|
|
2016-06-27 13:02:02 -04:00
|
|
|
/** @experimental */
|
2016-06-22 17:56:10 -04:00
|
|
|
export declare const PRIMITIVE: Type;
|
|
|
|
|
2016-06-27 13:02:02 -04:00
|
|
|
/** @experimental */
|
2016-06-22 17:56:10 -04:00
|
|
|
export declare class ReceivedMessage {
|
|
|
|
args: any[];
|
|
|
|
id: string;
|
2016-06-23 21:19:32 -04:00
|
|
|
method: string;
|
2016-06-22 17:56:10 -04:00
|
|
|
type: string;
|
|
|
|
constructor(data: {
|
|
|
|
[key: string]: any;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2016-06-27 15:27:23 -04:00
|
|
|
/** @stable */
|
2016-06-22 17:56:10 -04:00
|
|
|
export interface SafeHtml extends SafeValue {
|
|
|
|
}
|
|
|
|
|
2016-06-27 15:27:23 -04:00
|
|
|
/** @stable */
|
2016-06-22 17:56:10 -04:00
|
|
|
export interface SafeResourceUrl extends SafeValue {
|
|
|
|
}
|
|
|
|
|
2016-06-27 15:27:23 -04:00
|
|
|
/** @stable */
|
2016-06-22 17:56:10 -04:00
|
|
|
export interface SafeScript extends SafeValue {
|
|
|
|
}
|
|
|
|
|
2016-06-27 15:27:23 -04:00
|
|
|
/** @stable */
|
2016-06-22 17:56:10 -04:00
|
|
|
export interface SafeStyle extends SafeValue {
|
|
|
|
}
|
|
|
|
|
2016-06-27 15:27:23 -04:00
|
|
|
/** @stable */
|
2016-06-22 17:56:10 -04:00
|
|
|
export interface SafeUrl extends SafeValue {
|
|
|
|
}
|
|
|
|
|
2016-06-27 15:27:23 -04:00
|
|
|
/** @experimental */
|
2016-06-22 17:56:10 -04:00
|
|
|
export declare abstract class ServiceMessageBroker {
|
|
|
|
abstract registerMethod(methodName: string, signature: Type[], method: Function, returnType?: Type): void;
|
|
|
|
}
|
|
|
|
|
2016-06-27 15:27:23 -04:00
|
|
|
/** @experimental */
|
2016-06-22 17:56:10 -04:00
|
|
|
export declare abstract class ServiceMessageBrokerFactory {
|
|
|
|
abstract createMessageBroker(channel: string, runInZone?: boolean): ServiceMessageBroker;
|
|
|
|
}
|
|
|
|
|
2016-06-27 13:02:02 -04:00
|
|
|
/** @experimental */
|
2016-06-22 17:56:10 -04:00
|
|
|
export declare class Title {
|
|
|
|
getTitle(): string;
|
|
|
|
setTitle(newTitle: string): void;
|
|
|
|
}
|
|
|
|
|
2016-06-27 13:02:02 -04:00
|
|
|
/** @experimental */
|
2016-06-22 17:56:10 -04:00
|
|
|
export declare class UiArguments {
|
|
|
|
args: FnArg[];
|
2016-06-23 21:19:32 -04:00
|
|
|
method: string;
|
2016-06-22 17:56:10 -04:00
|
|
|
constructor(method: string, args?: FnArg[]);
|
|
|
|
}
|
|
|
|
|
2016-06-27 13:02:02 -04:00
|
|
|
/** @experimental */
|
2016-06-22 17:56:10 -04:00
|
|
|
export declare class WebWorkerInstance {
|
|
|
|
bus: MessageBus;
|
2016-06-23 21:19:32 -04:00
|
|
|
worker: Worker;
|
2016-06-22 17:56:10 -04:00
|
|
|
}
|
|
|
|
|
2016-06-27 13:02:02 -04:00
|
|
|
/** @experimental */
|
2016-06-22 17:56:10 -04:00
|
|
|
export declare const WORKER_APP_APPLICATION_PROVIDERS: Array<any>;
|
|
|
|
|
2016-06-27 13:02:02 -04:00
|
|
|
/** @experimental */
|
2016-06-22 17:56:10 -04:00
|
|
|
export declare const WORKER_APP_LOCATION_PROVIDERS: ({
|
|
|
|
provide: typeof PlatformLocation;
|
|
|
|
useClass: typeof WebWorkerPlatformLocation;
|
|
|
|
} | {
|
|
|
|
provide: any;
|
|
|
|
useFactory: (platformLocation: WebWorkerPlatformLocation, zone: NgZone) => () => Promise<boolean>;
|
|
|
|
multi: boolean;
|
|
|
|
deps: (typeof PlatformLocation | typeof NgZone)[];
|
|
|
|
})[];
|
|
|
|
|
2016-06-27 13:02:02 -04:00
|
|
|
/** @experimental */
|
2016-06-22 17:56:10 -04:00
|
|
|
export declare const WORKER_APP_PLATFORM_PROVIDERS: Array<any>;
|
|
|
|
|
2016-06-27 13:02:02 -04:00
|
|
|
/** @experimental */
|
2016-06-22 17:56:10 -04:00
|
|
|
export declare const WORKER_SCRIPT: OpaqueToken;
|
|
|
|
|
2016-06-27 13:02:02 -04:00
|
|
|
/** @experimental */
|
2016-06-22 17:56:10 -04:00
|
|
|
export declare const WORKER_UI_APPLICATION_PROVIDERS: Array<any>;
|
|
|
|
|
2016-06-27 13:02:02 -04:00
|
|
|
/** @experimental */
|
2016-06-22 17:56:10 -04:00
|
|
|
export declare const WORKER_UI_LOCATION_PROVIDERS: (typeof MessageBasedPlatformLocation | typeof BrowserPlatformLocation | {
|
|
|
|
provide: any;
|
|
|
|
useFactory: (injector: Injector) => () => void;
|
|
|
|
multi: boolean;
|
|
|
|
deps: typeof Injector[];
|
|
|
|
})[];
|
|
|
|
|
2016-06-27 13:02:02 -04:00
|
|
|
/** @experimental */
|
2016-06-22 17:56:10 -04:00
|
|
|
export declare const WORKER_UI_PLATFORM_PROVIDERS: Array<any>;
|
|
|
|
|
2016-06-27 13:02:02 -04:00
|
|
|
/** @experimental */
|
2016-06-22 17:56:10 -04:00
|
|
|
export declare const WORKER_UI_STARTABLE_MESSAGING_SERVICE: OpaqueToken;
|
|
|
|
|
2016-06-27 13:02:02 -04:00
|
|
|
/** @experimental */
|
refactor(core): clean up platform bootstrap and initTestEnvironment
- Introduces `CompilerFactory` which can be part of a `PlatformRef`.
- Introduces `WorkerAppModule`, `WorkerUiModule`, `ServerModule`
- Introduces `serverDynamicPlatform` for applications using runtime compilation
on the server.
- Changes browser bootstrap for runtime and offline compilation (see below for an example).
* introduces `bootstrapModule` and `bootstrapModuleFactory` in `@angular/core`
* introduces new `browserDynamicPlatform` in `@angular/platform-browser-dynamic
- Changes `initTestEnvironment` (which used to be `setBaseTestProviders`) to not take a compiler factory any more (see below for an example).
BREAKING CHANGE:
## Migration from `setBaseTestProviders` to `initTestEnvironment`:
- For the browser platform:
BEFORE:
```
import {setBaseTestProviders} from ‘@angular/core/testing’;
import {TEST_BROWSER_DYNAMIC_PLATFORM_PROVIDERS,
TEST_BROWSER_DYNAMIC_APPLICATION_PROVIDERS} from ‘@angular/platform-browser-dynamic/testing’;
setBaseTestProviders(TEST_BROWSER_DYNAMIC_PLATFORM_PROVIDERS,
TEST_BROWSER_DYNAMIC_APPLICATION_PROVIDERS);
```
AFTER:
```
import {initTestEnvironment} from ‘@angular/core/testing’;
import {browserDynamicTestPlatform,
BrowserDynamicTestModule} from ‘@angular/platform-browser-dynamic/testing’;
initTestEnvironment(
BrowserDynamicTestModule,
browserDynamicTestPlatform());
```
- For the server platform:
BEFORE:
```
import {setBaseTestProviders} from ‘@angular/core/testing’;
import {TEST_SERVER_PLATFORM_PROVIDERS,
TEST_SERVER_APPLICATION_PROVIDERS} from ‘@angular/platform-server/testing/server’;
setBaseTestProviders(TEST_SERVER_PLATFORM_PROVIDERS,
TEST_SERVER_APPLICATION_PROVIDERS);
```
AFTER:
```
import {initTestEnvironment} from ‘@angular/core/testing’;
import {serverTestPlatform,
ServerTestModule} from ‘@angular/platform-browser-dynamic/testing’;
initTestEnvironment(
ServerTestModule,
serverTestPlatform());
```
## Bootstrap changes
```
@AppModule({
modules: [BrowserModule],
precompile: [MainComponent],
providers: […], // additional providers
directives: […], // additional platform directives
pipes: […] // additional platform pipes
})
class MyModule {
constructor(appRef: ApplicationRef) {
appRef.bootstrap(MainComponent);
}
}
// offline compile
import {browserPlatform} from ‘@angular/platform-browser’;
import {bootstrapModuleFactory} from ‘@angular/core’;
bootstrapModuleFactory(MyModuleNgFactory, browserPlatform());
// runtime compile long form
import {browserDynamicPlatform} from ‘@angular/platform-browser-dynamic’;
import {bootstrapModule} from ‘@angular/core’;
bootstrapModule(MyModule, browserDynamicPlatform());
```
Closes #9922
Part of #9726
2016-07-08 13:47:17 -04:00
|
|
|
export declare class WorkerAppModule {
|
|
|
|
}
|
|
|
|
|
|
|
|
/** @experimental */
|
|
|
|
export declare const workerAppPlatform: () => PlatformRef;
|
|
|
|
|
|
|
|
/** @experimental */
|
|
|
|
export declare class WorkerUiModule {
|
|
|
|
}
|
2016-06-22 17:56:10 -04:00
|
|
|
|
2016-06-27 13:02:02 -04:00
|
|
|
/** @experimental */
|
refactor(core): clean up platform bootstrap and initTestEnvironment
- Introduces `CompilerFactory` which can be part of a `PlatformRef`.
- Introduces `WorkerAppModule`, `WorkerUiModule`, `ServerModule`
- Introduces `serverDynamicPlatform` for applications using runtime compilation
on the server.
- Changes browser bootstrap for runtime and offline compilation (see below for an example).
* introduces `bootstrapModule` and `bootstrapModuleFactory` in `@angular/core`
* introduces new `browserDynamicPlatform` in `@angular/platform-browser-dynamic
- Changes `initTestEnvironment` (which used to be `setBaseTestProviders`) to not take a compiler factory any more (see below for an example).
BREAKING CHANGE:
## Migration from `setBaseTestProviders` to `initTestEnvironment`:
- For the browser platform:
BEFORE:
```
import {setBaseTestProviders} from ‘@angular/core/testing’;
import {TEST_BROWSER_DYNAMIC_PLATFORM_PROVIDERS,
TEST_BROWSER_DYNAMIC_APPLICATION_PROVIDERS} from ‘@angular/platform-browser-dynamic/testing’;
setBaseTestProviders(TEST_BROWSER_DYNAMIC_PLATFORM_PROVIDERS,
TEST_BROWSER_DYNAMIC_APPLICATION_PROVIDERS);
```
AFTER:
```
import {initTestEnvironment} from ‘@angular/core/testing’;
import {browserDynamicTestPlatform,
BrowserDynamicTestModule} from ‘@angular/platform-browser-dynamic/testing’;
initTestEnvironment(
BrowserDynamicTestModule,
browserDynamicTestPlatform());
```
- For the server platform:
BEFORE:
```
import {setBaseTestProviders} from ‘@angular/core/testing’;
import {TEST_SERVER_PLATFORM_PROVIDERS,
TEST_SERVER_APPLICATION_PROVIDERS} from ‘@angular/platform-server/testing/server’;
setBaseTestProviders(TEST_SERVER_PLATFORM_PROVIDERS,
TEST_SERVER_APPLICATION_PROVIDERS);
```
AFTER:
```
import {initTestEnvironment} from ‘@angular/core/testing’;
import {serverTestPlatform,
ServerTestModule} from ‘@angular/platform-browser-dynamic/testing’;
initTestEnvironment(
ServerTestModule,
serverTestPlatform());
```
## Bootstrap changes
```
@AppModule({
modules: [BrowserModule],
precompile: [MainComponent],
providers: […], // additional providers
directives: […], // additional platform directives
pipes: […] // additional platform pipes
})
class MyModule {
constructor(appRef: ApplicationRef) {
appRef.bootstrap(MainComponent);
}
}
// offline compile
import {browserPlatform} from ‘@angular/platform-browser’;
import {bootstrapModuleFactory} from ‘@angular/core’;
bootstrapModuleFactory(MyModuleNgFactory, browserPlatform());
// runtime compile long form
import {browserDynamicPlatform} from ‘@angular/platform-browser-dynamic’;
import {bootstrapModule} from ‘@angular/core’;
bootstrapModule(MyModule, browserDynamicPlatform());
```
Closes #9922
Part of #9726
2016-07-08 13:47:17 -04:00
|
|
|
export declare const workerUiPlatform: () => PlatformRef;
|