From b3c65a9a93edf4b58b1bf056f23b8d80bc941bc5 Mon Sep 17 00:00:00 2001 From: Ward Bell Date: Fri, 18 Nov 2016 20:29:05 -0800 Subject: [PATCH] docs(systemjs.web): auto-bootstrap option that creates its own AppModule and boots it. (#2833) For specific plunkers, e.g. "QuickStart (reboot edition)" PR #2762, that shouldn't have AppModule or main.ts Rescinds the automatic bootstrapping and exclusion of `main.ts` in #2786 and #2756 Only autoBootstraps when `window.autoBootstrap === true`. --- .../_boilerplate/systemjs.config.web.build.js | 23 ++++++++++--------- .../_boilerplate/systemjs.config.web.js | 23 ++++++++++--------- .../docs/_examples/ngmodule/ts/index.0.html | 1 - .../docs/_examples/ngmodule/ts/index.1.html | 1 - .../docs/_examples/ngmodule/ts/index.1b.html | 1 - .../docs/_examples/ngmodule/ts/index.2.html | 1 - .../docs/_examples/ngmodule/ts/index.3.html | 1 - .../_examples/testing/ts/browser-test-shim.js | 2 -- tools/plunker-builder/builder.js | 1 - tools/plunker-builder/indexHtmlTranslator.js | 2 +- 10 files changed, 25 insertions(+), 31 deletions(-) diff --git a/public/docs/_examples/_boilerplate/systemjs.config.web.build.js b/public/docs/_examples/_boilerplate/systemjs.config.web.build.js index 484de9184c..2e90b8f54c 100644 --- a/public/docs/_examples/_boilerplate/systemjs.config.web.build.js +++ b/public/docs/_examples/_boilerplate/systemjs.config.web.build.js @@ -77,9 +77,11 @@ } }); - if (!global.noBootstrap) { bootstrap(); } + if (global.autoBootstrap) { bootstrap(); } - // Bootstrap the `AppModule`(skip the `app/main.ts` that normally does this) + // 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'); @@ -99,17 +101,10 @@ .catch(function(err){ console.error(err); }); } - // Import AppModule or make the default AppModule if there isn't one + // Make the default AppModule // returns a promise for the AppModule function getAppModule() { - if (global.noAppModule) { - return makeAppModule(); - } - return System.import('app/app.module').catch(makeAppModule) - } - - function makeAppModule() { - console.log('No AppModule; making a bare-bones, default AppModule'); + console.log('Making a bare-bones, default AppModule'); return Promise.all([ System.import('@angular/core'), @@ -135,3 +130,9 @@ }) } })(this); + +/* +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 +*/ diff --git a/public/docs/_examples/_boilerplate/systemjs.config.web.js b/public/docs/_examples/_boilerplate/systemjs.config.web.js index 4f9463bffc..cdd19c67ba 100644 --- a/public/docs/_examples/_boilerplate/systemjs.config.web.js +++ b/public/docs/_examples/_boilerplate/systemjs.config.web.js @@ -64,9 +64,11 @@ } }); - if (!global.noBootstrap) { bootstrap(); } + if (global.autoBootstrap) { bootstrap(); } - // Bootstrap the `AppModule`(skip the `app/main.ts` that normally does this) + // 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'); @@ -86,17 +88,10 @@ .catch(function(err){ console.error(err); }); } - // Import AppModule or make the default AppModule if there isn't one + // Make the default AppModule // returns a promise for the AppModule function getAppModule() { - if (global.noAppModule) { - return makeAppModule(); - } - return System.import('app/app.module').catch(makeAppModule) - } - - function makeAppModule() { - console.log('No AppModule; making a bare-bones, default AppModule'); + console.log('Making a bare-bones, default AppModule'); return Promise.all([ System.import('@angular/core'), @@ -122,3 +117,9 @@ }) } })(this); + +/* +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 +*/ diff --git a/public/docs/_examples/ngmodule/ts/index.0.html b/public/docs/_examples/ngmodule/ts/index.0.html index 1b72565156..97f8f9e685 100644 --- a/public/docs/_examples/ngmodule/ts/index.0.html +++ b/public/docs/_examples/ngmodule/ts/index.0.html @@ -13,7 +13,6 @@ - - - - - ' + to: '' }, // Clear script like this: //