2016-06-23 12:47:54 -04:00
|
|
|
/**
|
|
|
|
* @license
|
|
|
|
* Copyright Google Inc. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by an MIT-style license that can be
|
|
|
|
* found in the LICENSE file at https://angular.io/license
|
|
|
|
*/
|
|
|
|
|
2016-05-02 01:54:19 -04:00
|
|
|
declare var System: any;
|
|
|
|
|
|
|
|
|
2016-06-08 18:45:15 -04:00
|
|
|
(function(global: any /** TODO #9100 */) {
|
2016-05-02 01:54:19 -04:00
|
|
|
|
|
|
|
writeScriptTag('/all/playground/vendor/es6-shim.js');
|
|
|
|
writeScriptTag('/all/playground/vendor/zone.js');
|
|
|
|
writeScriptTag('/all/playground/vendor/long-stack-trace-zone.js');
|
|
|
|
writeScriptTag('/all/playground/vendor/system.src.js');
|
|
|
|
writeScriptTag('/all/playground/vendor/Reflect.js');
|
2016-05-13 16:22:29 -04:00
|
|
|
writeScriptTag('/all/playground/vendor/rxjs/bundles/Rx.js', 'playgroundBootstrap()');
|
2016-06-01 17:58:11 -04:00
|
|
|
(<any>global).playgroundBootstrap = playgroundBootstrap;
|
2016-05-02 01:54:19 -04:00
|
|
|
|
|
|
|
function playgroundBootstrap() {
|
|
|
|
// check query param
|
|
|
|
var useBundles = location.search.indexOf('bundles=false') == -1;
|
|
|
|
if (useBundles) {
|
|
|
|
System.config({
|
|
|
|
map: {
|
|
|
|
'index': 'index.js',
|
2016-05-20 12:08:39 -04:00
|
|
|
'@angular/core': '/packages-dist/core/bundles/core.umd.js',
|
|
|
|
'@angular/common': '/packages-dist/common/bundles/common.umd.js',
|
|
|
|
'@angular/compiler': '/packages-dist/compiler/bundles/compiler.umd.js',
|
|
|
|
'@angular/platform-browser': '/packages-dist/platform-browser/bundles/platform-browser.umd.js',
|
2016-06-10 13:21:53 -04:00
|
|
|
'@angular/platform-browser-dynamic': '/packages-dist/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js',
|
2016-05-20 12:08:39 -04:00
|
|
|
'@angular/http': '/packages-dist/http/bundles/http.umd.js',
|
|
|
|
'@angular/upgrade': '/packages-dist/upgrade/bundles/upgrade.umd.js',
|
|
|
|
'@angular/router-deprecated': '/packages-dist/router-deprecated/bundles/router-deprecated.umd.js',
|
2016-06-22 02:06:35 -04:00
|
|
|
'@angular/router': '/packages-dist/router/bundles/router.umd.js',
|
2016-05-02 01:54:19 -04:00
|
|
|
'@angular/core/src/facade': '/all/@angular/core/src/facade',
|
2016-05-24 20:10:30 -04:00
|
|
|
'rxjs': location.pathname.replace(/\w+\.html$/i, '') + 'rxjs'
|
2016-05-02 01:54:19 -04:00
|
|
|
},
|
|
|
|
packages: {
|
2016-05-02 13:36:58 -04:00
|
|
|
'app': {defaultExtension: 'js'},
|
|
|
|
'@angular/core/src/facade': {defaultExtension: 'js'}
|
2016-05-02 01:54:19 -04:00
|
|
|
}
|
|
|
|
});
|
|
|
|
} else {
|
2016-05-02 13:36:58 -04:00
|
|
|
console.warn(
|
|
|
|
"Not using the Angular bundles. Don't use this configuration for e2e/performance tests!");
|
2016-05-02 01:54:19 -04:00
|
|
|
|
|
|
|
System.config({
|
2016-05-02 13:36:58 -04:00
|
|
|
map: {'index': 'index.js', '@angular': '/all/@angular'},
|
2016-05-02 01:54:19 -04:00
|
|
|
packages: {
|
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
|
|
|
'app': { defaultExtension: 'js' },
|
2016-05-02 13:36:58 -04:00
|
|
|
'@angular/core': {main: 'index.js', defaultExtension: 'js'},
|
|
|
|
'@angular/compiler': {main: 'index.js', defaultExtension: 'js'},
|
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
|
|
|
'@angular/router': {main: 'index.js', defaultExtension: 'js'},
|
2016-05-02 13:36:58 -04:00
|
|
|
'@angular/common': {main: 'index.js', defaultExtension: 'js'},
|
|
|
|
'@angular/platform-browser': {main: 'index.js', defaultExtension: 'js'},
|
2016-06-20 11:09:16 -04:00
|
|
|
'@angular/platform-browser-dynamic': {main: 'index.js', defaultExtension: 'js'}
|
2016-05-02 01:54:19 -04:00
|
|
|
// 'rxjs': {
|
|
|
|
// defaultExtension: 'js'
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// BOOTSTRAP the app!
|
2016-06-08 18:45:15 -04:00
|
|
|
System.import('index').then(function(m: any /** TODO #9100 */) { m.main(); }, console.error.bind(console));
|
2016-05-02 01:54:19 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-06-08 18:45:15 -04:00
|
|
|
function writeScriptTag(scriptUrl: any /** TODO #9100 */, onload?: any /** TODO #9100 */) {
|
2016-05-02 01:54:19 -04:00
|
|
|
document.write(`<script src="${scriptUrl}" onload="${onload}"></script>`);
|
|
|
|
}
|
|
|
|
}(window));
|