2016-04-27 14:28:22 -04:00
|
|
|
/**
|
2016-11-05 00:59:51 -04:00
|
|
|
* WEB ANGULAR VERSION
|
2016-09-01 02:56:12 -04:00
|
|
|
* (based on systemjs.config.js in angular.io)
|
2016-09-19 23:24:40 -04:00
|
|
|
* System configuration for Angular samples
|
2016-04-27 14:28:22 -04:00
|
|
|
* Adjust as necessary for your application needs.
|
|
|
|
*/
|
2016-09-01 02:56:12 -04:00
|
|
|
(function (global) {
|
|
|
|
System.config({
|
2016-05-11 21:24:43 -04:00
|
|
|
// DEMO ONLY! REAL CODE SHOULD NOT TRANSPILE IN THE BROWSER
|
2016-05-15 17:49:09 -04:00
|
|
|
transpiler: 'ts',
|
2016-04-27 14:28:22 -04:00
|
|
|
typescriptOptions: {
|
2016-11-18 14:31:32 -05:00
|
|
|
// Copy of compiler options in standard tsconfig.json
|
2016-11-05 00:59:51 -04:00
|
|
|
"target": "es5",
|
|
|
|
"module": "commonjs",
|
|
|
|
"moduleResolution": "node",
|
|
|
|
"sourceMap": true,
|
|
|
|
"emitDecoratorMetadata": true,
|
|
|
|
"experimentalDecorators": true,
|
2016-12-13 23:57:47 -05:00
|
|
|
"lib": ["es2015", "dom"],
|
2016-11-05 00:59:51 -04:00
|
|
|
"noImplicitAny": true,
|
2016-11-18 14:31:32 -05:00
|
|
|
"suppressImplicitAnyIndexErrors": true
|
2016-05-15 17:49:09 -04:00
|
|
|
},
|
|
|
|
meta: {
|
|
|
|
'typescript': {
|
|
|
|
"exports": "ts"
|
|
|
|
}
|
2016-04-27 14:28:22 -04:00
|
|
|
},
|
2016-09-01 02:56:12 -04:00
|
|
|
paths: {
|
|
|
|
// paths serve as alias
|
|
|
|
'npm:': 'https://unpkg.com/'
|
|
|
|
},
|
|
|
|
// map tells the System loader where to look for things
|
|
|
|
map: {
|
|
|
|
// our app is within the app folder
|
|
|
|
app: 'app',
|
|
|
|
|
|
|
|
// angular bundles
|
|
|
|
'@angular/core': 'npm:@angular/core/bundles/core.umd.js',
|
|
|
|
'@angular/common': 'npm:@angular/common/bundles/common.umd.js',
|
|
|
|
'@angular/compiler': 'npm:@angular/compiler/bundles/compiler.umd.js',
|
|
|
|
'@angular/platform-browser': 'npm:@angular/platform-browser/bundles/platform-browser.umd.js',
|
|
|
|
'@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js',
|
|
|
|
'@angular/http': 'npm:@angular/http/bundles/http.umd.js',
|
|
|
|
'@angular/router': 'npm:@angular/router/bundles/router.umd.js',
|
2016-11-19 01:28:24 -05:00
|
|
|
'@angular/router/upgrade': 'npm:@angular/router/bundles/router-upgrade.umd.js',
|
2016-09-01 02:56:12 -04:00
|
|
|
'@angular/forms': 'npm:@angular/forms/bundles/forms.umd.js',
|
2016-09-13 18:56:35 -04:00
|
|
|
'@angular/upgrade': 'npm:@angular/upgrade/bundles/upgrade.umd.js',
|
2016-11-12 17:38:14 -05:00
|
|
|
'@angular/upgrade/static': 'npm:@angular/upgrade/bundles/upgrade-static.umd.js',
|
2016-04-27 14:28:22 -04:00
|
|
|
|
2016-09-01 02:56:12 -04:00
|
|
|
// other libraries
|
2016-12-21 16:39:40 -05:00
|
|
|
'rxjs': 'npm:rxjs@5.0.1',
|
2016-10-20 00:52:32 -04:00
|
|
|
'angular-in-memory-web-api': 'npm:angular-in-memory-web-api/bundles/in-memory-web-api.umd.js',
|
2016-11-29 18:39:53 -05:00
|
|
|
'ts': 'npm:plugin-typescript@5.2.7/lib/plugin.js',
|
|
|
|
'typescript': 'npm:typescript@2.0.10/lib/typescript.js',
|
2016-09-01 02:56:12 -04:00
|
|
|
|
|
|
|
},
|
|
|
|
// packages tells the System loader how to load when no filename and/or no extension
|
|
|
|
packages: {
|
|
|
|
app: {
|
|
|
|
main: './main.ts',
|
|
|
|
defaultExtension: 'ts'
|
|
|
|
},
|
|
|
|
rxjs: {
|
|
|
|
defaultExtension: 'js'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
2016-11-05 00:59:51 -04:00
|
|
|
|
2016-11-18 23:29:05 -05:00
|
|
|
if (global.autoBootstrap) { bootstrap(); }
|
2016-11-05 00:59:51 -04:00
|
|
|
|
2016-11-18 23:29:05 -05:00
|
|
|
// Bootstrap with a default `AppModule`
|
|
|
|
// ignore an `app/app.module.ts` and `app/main.ts`, even if present
|
|
|
|
// This function exists primarily (exclusively?) for the QuickStart
|
2016-11-05 00:59:51 -04:00
|
|
|
function bootstrap() {
|
2016-11-18 14:31:32 -05:00
|
|
|
console.log('Auto-bootstrapping');
|
2016-11-05 00:59:51 -04:00
|
|
|
|
|
|
|
// Stub out `app/main.ts` so System.import('app') doesn't fail if called in the index.html
|
|
|
|
System.set(System.normalizeSync('app/main.ts'), System.newModule({ }));
|
|
|
|
|
|
|
|
// bootstrap and launch the app (equivalent to standard main.ts)
|
|
|
|
Promise.all([
|
|
|
|
System.import('@angular/platform-browser-dynamic'),
|
2016-11-18 14:31:32 -05:00
|
|
|
getAppModule()
|
2016-11-05 00:59:51 -04:00
|
|
|
])
|
|
|
|
.then(function (imports) {
|
|
|
|
var platform = imports[0];
|
|
|
|
var app = imports[1];
|
|
|
|
platform.platformBrowserDynamic().bootstrapModule(app.AppModule);
|
|
|
|
})
|
|
|
|
.catch(function(err){ console.error(err); });
|
|
|
|
}
|
|
|
|
|
2016-11-18 23:29:05 -05:00
|
|
|
// Make the default AppModule
|
2016-11-18 14:31:32 -05:00
|
|
|
// returns a promise for the AppModule
|
|
|
|
function getAppModule() {
|
2016-11-18 23:29:05 -05:00
|
|
|
console.log('Making a bare-bones, default AppModule');
|
2016-11-18 14:31:32 -05:00
|
|
|
|
|
|
|
return Promise.all([
|
|
|
|
System.import('@angular/core'),
|
|
|
|
System.import('@angular/platform-browser'),
|
|
|
|
System.import('app/app.component')
|
|
|
|
])
|
|
|
|
.then(function (imports) {
|
|
|
|
|
|
|
|
var core = imports[0];
|
|
|
|
var browser = imports[1];
|
|
|
|
var appComp = imports[2].AppComponent;
|
|
|
|
|
|
|
|
var AppModule = function() {}
|
|
|
|
|
|
|
|
AppModule.annotations = [
|
|
|
|
new core.NgModule({
|
|
|
|
imports: [ browser.BrowserModule ],
|
|
|
|
declarations: [ appComp ],
|
|
|
|
bootstrap: [ appComp ]
|
|
|
|
})
|
|
|
|
]
|
|
|
|
return {AppModule: AppModule};
|
|
|
|
})
|
|
|
|
}
|
2016-04-27 14:28:22 -04:00
|
|
|
})(this);
|
2016-11-18 23:29:05 -05:00
|
|
|
|
|
|
|
/*
|
|
|
|
Copyright 2016 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 http://angular.io/license
|
|
|
|
*/
|