From b2f41484721265026c87fb5c8780a8a4a57d5b61 Mon Sep 17 00:00:00 2001 From: Ward Bell Date: Mon, 6 Feb 2017 18:35:49 -0800 Subject: [PATCH] chore(quickstart): restore app.module and main (#3166) We seemed to create more confusion by omitting app.module (and main) in QS than we gained in simplicity of QS Every other example requires these files. This PR restores them to QS _but doesn't talk about them_ in QS, leaving _that_ to the Setup guide. --- .../src/systemjs.config.web.build.js | 52 ------------------- .../_boilerplate/src/systemjs.config.web.js | 52 ------------------- .../docs/_examples/quickstart/ts/plnkr.json | 2 + .../_examples/quickstart/ts/src/index.html | 5 -- public/docs/ts/latest/cli-quickstart.jade | 32 ++++++------ public/docs/ts/latest/guide/_data.json | 1 - public/docs/ts/latest/guide/appmodule.jade | 37 +++++++------ public/docs/ts/latest/guide/architecture.jade | 2 +- .../ts/latest/guide/learning-angular.jade | 5 +- public/docs/ts/latest/guide/ngmodule.jade | 4 +- public/docs/ts/latest/guide/setup.jade | 24 ++++----- 11 files changed, 50 insertions(+), 166 deletions(-) diff --git a/public/docs/_examples/_boilerplate/src/systemjs.config.web.build.js b/public/docs/_examples/_boilerplate/src/systemjs.config.web.build.js index bfb9dbcd99..c27642ce02 100644 --- a/public/docs/_examples/_boilerplate/src/systemjs.config.web.build.js +++ b/public/docs/_examples/_boilerplate/src/systemjs.config.web.build.js @@ -79,58 +79,6 @@ } }); - if (global.autoBootstrap) { bootstrap(); } - - // 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 - function bootstrap() { - console.log('Auto-bootstrapping'); - - // 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'), - getAppModule() - ]) - .then(function (imports) { - var platform = imports[0]; - var app = imports[1]; - platform.platformBrowserDynamic().bootstrapModule(app.AppModule); - }) - .catch(function(err){ console.error(err); }); - } - - // Make the default AppModule - // returns a promise for the AppModule - function getAppModule() { - console.log('Making a bare-bones, default AppModule'); - - 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}; - }) - } })(this); /* diff --git a/public/docs/_examples/_boilerplate/src/systemjs.config.web.js b/public/docs/_examples/_boilerplate/src/systemjs.config.web.js index 576bded343..dc0234a172 100644 --- a/public/docs/_examples/_boilerplate/src/systemjs.config.web.js +++ b/public/docs/_examples/_boilerplate/src/systemjs.config.web.js @@ -66,58 +66,6 @@ } }); - if (global.autoBootstrap) { bootstrap(); } - - // 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 - function bootstrap() { - console.log('Auto-bootstrapping'); - - // 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'), - getAppModule() - ]) - .then(function (imports) { - var platform = imports[0]; - var app = imports[1]; - platform.platformBrowserDynamic().bootstrapModule(app.AppModule); - }) - .catch(function(err){ console.error(err); }); - } - - // Make the default AppModule - // returns a promise for the AppModule - function getAppModule() { - console.log('Making a bare-bones, default AppModule'); - - 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}; - }) - } })(this); /* diff --git a/public/docs/_examples/quickstart/ts/plnkr.json b/public/docs/_examples/quickstart/ts/plnkr.json index 5fb55b50ad..8edf7c25ea 100644 --- a/public/docs/_examples/quickstart/ts/plnkr.json +++ b/public/docs/_examples/quickstart/ts/plnkr.json @@ -3,6 +3,8 @@ "basePath": "src/", "files": [ "app/app.component.ts", + "app/app.module.ts", + "main.ts", "index.html" ], "open": "app/app.component.ts", diff --git a/public/docs/_examples/quickstart/ts/src/index.html b/public/docs/_examples/quickstart/ts/src/index.html index a6d62dae0a..21fb56edb9 100644 --- a/public/docs/_examples/quickstart/ts/src/index.html +++ b/public/docs/_examples/quickstart/ts/src/index.html @@ -16,11 +16,6 @@ - - - - -