From e8921365b7eff8c86aac7047dd4b886d459bf389 Mon Sep 17 00:00:00 2001 From: Kapunahele Wong Date: Tue, 22 Jan 2019 14:11:35 -0500 Subject: [PATCH] docs: remove coremodule references (#28434) PR Close #28434 --- .../ngmodule-faq/contact.1b.stackblitz.json | 24 - .../ngmodule-faq/contact.2.stackblitz.json | 26 - .../ngmodule-faq/e2e/src/app.e2e-spec.ts | 223 ---- .../examples/ngmodule-faq/example-config.json | 0 .../ngmodule-faq/minimal.0.stackblitz.json | 12 - .../ngmodule-faq/pre-shared.3.stackblitz.json | 40 - .../src/app/app-routing.module.3.ts | 19 - .../src/app/app-routing.module.ts | 30 - .../ngmodule-faq/src/app/app.component.0.ts | 10 - .../ngmodule-faq/src/app/app.component.1.ts | 17 - .../ngmodule-faq/src/app/app.component.1b.ts | 13 - .../ngmodule-faq/src/app/app.component.2.ts | 10 - .../ngmodule-faq/src/app/app.component.3.ts | 17 - .../ngmodule-faq/src/app/app.component.ts | 17 - .../ngmodule-faq/src/app/app.module.0.ts | 13 - .../ngmodule-faq/src/app/app.module.1.ts | 52 - .../ngmodule-faq/src/app/app.module.1b.ts | 46 - .../ngmodule-faq/src/app/app.module.2.ts | 36 - .../ngmodule-faq/src/app/app.module.ts | 39 - .../app/contact/contact-routing.module.3.ts | 14 - .../src/app/contact/contact-routing.module.ts | 16 - .../src/app/contact/contact.component.3.ts | 53 - .../src/app/contact/contact.component.css | 32 - .../src/app/contact/contact.component.html | 37 - .../src/app/contact/contact.component.ts | 54 - .../src/app/contact/contact.module.0.ts | 11 - .../src/app/contact/contact.module.2.ts | 37 - .../src/app/contact/contact.module.3.ts | 44 - .../src/app/contact/contact.module.ts | 19 - .../src/app/contact/contact.service.ts | 37 - .../ngmodule-faq/src/app/core/core.module.ts | 48 - .../src/app/core/title.component.html | 6 - .../src/app/core/title.component.ts | 16 - .../ngmodule-faq/src/app/core/user.service.ts | 32 - .../src/app/crisis/crisis-detail.component.ts | 19 - .../src/app/crisis/crisis-list.component.ts | 21 - .../src/app/crisis/crisis-routing.module.ts | 18 - .../src/app/crisis/crisis.module.ts | 14 - .../src/app/crisis/crisis.service.ts | 33 - .../src/app/hero/hero-detail.component.ts | 31 - .../src/app/hero/hero-list.component.ts | 20 - .../src/app/hero/hero-routing.module.3.ts | 23 - .../src/app/hero/hero-routing.module.ts | 23 - .../src/app/hero/hero.component.3.ts | 18 - .../src/app/hero/hero.component.ts | 19 - .../src/app/hero/hero.module.3.ts | 21 - .../ngmodule-faq/src/app/hero/hero.module.ts | 16 - .../ngmodule-faq/src/app/hero/hero.service.ts | 36 - .../src/app/shared/awesome.pipe.ts | 10 - .../src/app/shared/highlight.directive.ts | 12 - .../src/app/shared/shared.module.ts | 18 - .../ngmodule-faq/src/app/user.service.ts | 8 - .../examples/ngmodule-faq/src/index.0.html | 15 - .../examples/ngmodule-faq/src/index.1.html | 13 - .../examples/ngmodule-faq/src/index.1b.html | 13 - .../examples/ngmodule-faq/src/index.2.html | 13 - .../examples/ngmodule-faq/src/index.3.html | 13 - .../examples/ngmodule-faq/src/index.html | 13 - .../examples/ngmodule-faq/src/main-static.ts | 13 - .../examples/ngmodule-faq/src/main.0.ts | 11 - .../examples/ngmodule-faq/src/main.1.ts | 11 - .../examples/ngmodule-faq/src/main.1b.ts | 11 - .../examples/ngmodule-faq/src/main.2.ts | 11 - .../examples/ngmodule-faq/src/main.3.ts | 11 - aio/content/examples/ngmodule-faq/src/main.ts | 12 - .../examples/ngmodule-faq/stackblitz.json | 40 - .../ngmodules/e2e/src/app.e2e-spec.ts | 31 +- .../ngmodules/src/app/app.component.ts | 2 +- .../examples/ngmodules/src/app/app.module.ts | 14 +- .../src/app/contact/contact.component.css | 17 + .../src/app/contact/contact.component.html | 22 +- .../src/app/contact/contact.component.ts | 24 +- .../src/app/contact/contact.module.ts | 4 +- .../ngmodules/src/app/core/core.module.ts | 46 - .../src/app/customers/customers.component.ts | 2 +- .../greeting.component.html} | 0 .../greeting.component.ts} | 8 +- .../src/app/greeting/greeting.module.ts | 36 + .../app/{core => greeting}/user.service.ts | 9 +- .../guide/dependency-injection-providers.md | 68 +- aio/content/guide/lazy-loading-ngmodules.md | 1 + aio/content/guide/ngmodule-faq.md | 31 +- aio/content/guide/providers.md | 8 +- aio/content/guide/router.md | 78 +- aio/content/guide/singleton-services.md | 147 ++- aio/content/guide/styleguide.md | 1019 +++++++---------- 86 files changed, 703 insertions(+), 2524 deletions(-) delete mode 100644 aio/content/examples/ngmodule-faq/contact.1b.stackblitz.json delete mode 100644 aio/content/examples/ngmodule-faq/contact.2.stackblitz.json delete mode 100644 aio/content/examples/ngmodule-faq/e2e/src/app.e2e-spec.ts delete mode 100644 aio/content/examples/ngmodule-faq/example-config.json delete mode 100644 aio/content/examples/ngmodule-faq/minimal.0.stackblitz.json delete mode 100644 aio/content/examples/ngmodule-faq/pre-shared.3.stackblitz.json delete mode 100644 aio/content/examples/ngmodule-faq/src/app/app-routing.module.3.ts delete mode 100644 aio/content/examples/ngmodule-faq/src/app/app-routing.module.ts delete mode 100644 aio/content/examples/ngmodule-faq/src/app/app.component.0.ts delete mode 100644 aio/content/examples/ngmodule-faq/src/app/app.component.1.ts delete mode 100644 aio/content/examples/ngmodule-faq/src/app/app.component.1b.ts delete mode 100644 aio/content/examples/ngmodule-faq/src/app/app.component.2.ts delete mode 100644 aio/content/examples/ngmodule-faq/src/app/app.component.3.ts delete mode 100644 aio/content/examples/ngmodule-faq/src/app/app.component.ts delete mode 100644 aio/content/examples/ngmodule-faq/src/app/app.module.0.ts delete mode 100644 aio/content/examples/ngmodule-faq/src/app/app.module.1.ts delete mode 100644 aio/content/examples/ngmodule-faq/src/app/app.module.1b.ts delete mode 100644 aio/content/examples/ngmodule-faq/src/app/app.module.2.ts delete mode 100644 aio/content/examples/ngmodule-faq/src/app/app.module.ts delete mode 100644 aio/content/examples/ngmodule-faq/src/app/contact/contact-routing.module.3.ts delete mode 100644 aio/content/examples/ngmodule-faq/src/app/contact/contact-routing.module.ts delete mode 100644 aio/content/examples/ngmodule-faq/src/app/contact/contact.component.3.ts delete mode 100644 aio/content/examples/ngmodule-faq/src/app/contact/contact.component.css delete mode 100644 aio/content/examples/ngmodule-faq/src/app/contact/contact.component.html delete mode 100644 aio/content/examples/ngmodule-faq/src/app/contact/contact.component.ts delete mode 100644 aio/content/examples/ngmodule-faq/src/app/contact/contact.module.0.ts delete mode 100644 aio/content/examples/ngmodule-faq/src/app/contact/contact.module.2.ts delete mode 100644 aio/content/examples/ngmodule-faq/src/app/contact/contact.module.3.ts delete mode 100644 aio/content/examples/ngmodule-faq/src/app/contact/contact.module.ts delete mode 100644 aio/content/examples/ngmodule-faq/src/app/contact/contact.service.ts delete mode 100644 aio/content/examples/ngmodule-faq/src/app/core/core.module.ts delete mode 100644 aio/content/examples/ngmodule-faq/src/app/core/title.component.html delete mode 100644 aio/content/examples/ngmodule-faq/src/app/core/title.component.ts delete mode 100644 aio/content/examples/ngmodule-faq/src/app/core/user.service.ts delete mode 100644 aio/content/examples/ngmodule-faq/src/app/crisis/crisis-detail.component.ts delete mode 100644 aio/content/examples/ngmodule-faq/src/app/crisis/crisis-list.component.ts delete mode 100644 aio/content/examples/ngmodule-faq/src/app/crisis/crisis-routing.module.ts delete mode 100644 aio/content/examples/ngmodule-faq/src/app/crisis/crisis.module.ts delete mode 100644 aio/content/examples/ngmodule-faq/src/app/crisis/crisis.service.ts delete mode 100644 aio/content/examples/ngmodule-faq/src/app/hero/hero-detail.component.ts delete mode 100644 aio/content/examples/ngmodule-faq/src/app/hero/hero-list.component.ts delete mode 100644 aio/content/examples/ngmodule-faq/src/app/hero/hero-routing.module.3.ts delete mode 100644 aio/content/examples/ngmodule-faq/src/app/hero/hero-routing.module.ts delete mode 100644 aio/content/examples/ngmodule-faq/src/app/hero/hero.component.3.ts delete mode 100644 aio/content/examples/ngmodule-faq/src/app/hero/hero.component.ts delete mode 100644 aio/content/examples/ngmodule-faq/src/app/hero/hero.module.3.ts delete mode 100644 aio/content/examples/ngmodule-faq/src/app/hero/hero.module.ts delete mode 100644 aio/content/examples/ngmodule-faq/src/app/hero/hero.service.ts delete mode 100644 aio/content/examples/ngmodule-faq/src/app/shared/awesome.pipe.ts delete mode 100644 aio/content/examples/ngmodule-faq/src/app/shared/highlight.directive.ts delete mode 100644 aio/content/examples/ngmodule-faq/src/app/shared/shared.module.ts delete mode 100644 aio/content/examples/ngmodule-faq/src/app/user.service.ts delete mode 100644 aio/content/examples/ngmodule-faq/src/index.0.html delete mode 100644 aio/content/examples/ngmodule-faq/src/index.1.html delete mode 100644 aio/content/examples/ngmodule-faq/src/index.1b.html delete mode 100644 aio/content/examples/ngmodule-faq/src/index.2.html delete mode 100644 aio/content/examples/ngmodule-faq/src/index.3.html delete mode 100644 aio/content/examples/ngmodule-faq/src/index.html delete mode 100644 aio/content/examples/ngmodule-faq/src/main-static.ts delete mode 100644 aio/content/examples/ngmodule-faq/src/main.0.ts delete mode 100644 aio/content/examples/ngmodule-faq/src/main.1.ts delete mode 100644 aio/content/examples/ngmodule-faq/src/main.1b.ts delete mode 100644 aio/content/examples/ngmodule-faq/src/main.2.ts delete mode 100644 aio/content/examples/ngmodule-faq/src/main.3.ts delete mode 100644 aio/content/examples/ngmodule-faq/src/main.ts delete mode 100644 aio/content/examples/ngmodule-faq/stackblitz.json delete mode 100644 aio/content/examples/ngmodules/src/app/core/core.module.ts rename aio/content/examples/ngmodules/src/app/{core/title.component.html => greeting/greeting.component.html} (100%) rename aio/content/examples/ngmodules/src/app/{core/title.component.ts => greeting/greeting.component.ts} (53%) create mode 100644 aio/content/examples/ngmodules/src/app/greeting/greeting.module.ts rename aio/content/examples/ngmodules/src/app/{core => greeting}/user.service.ts (68%) diff --git a/aio/content/examples/ngmodule-faq/contact.1b.stackblitz.json b/aio/content/examples/ngmodule-faq/contact.1b.stackblitz.json deleted file mode 100644 index 2946183c0d..0000000000 --- a/aio/content/examples/ngmodule-faq/contact.1b.stackblitz.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "description": "Contact NgModule v.1", - "files": [ - "src/app/app.component.1b.ts", - "src/app/app.module.1b.ts", - "src/app/highlight.directive.ts", - "src/app/title.component.html", - "src/app/title.component.ts", - "src/app/user.service.ts", - - "src/app/contact/awesome.pipe.ts", - "src/app/contact/contact.component.css", - "src/app/contact/contact.component.html", - "src/app/contact/contact.component.3.ts", - "src/app/contact/contact.service.ts", - "src/app/contact/contact-highlight.directive.ts", - - "src/main.1b.ts", - "src/styles.css", - "src/index.1b.html" - ], - "main": "src/index.1b.html", - "tags": ["NgModule"] -} diff --git a/aio/content/examples/ngmodule-faq/contact.2.stackblitz.json b/aio/content/examples/ngmodule-faq/contact.2.stackblitz.json deleted file mode 100644 index 3aaf1474a6..0000000000 --- a/aio/content/examples/ngmodule-faq/contact.2.stackblitz.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "description": "Contact NgModule v.2", - "files": [ - "src/app/app.component.2.ts", - "src/app/app.module.2.ts", - "src/app/highlight.directive.ts", - "src/app/title.component.html", - "src/app/title.component.ts", - "src/app/user.service.ts", - - "src/app/contact/contact.component.css", - "src/app/contact/contact.component.html", - "src/app/contact/contact.service.ts", - - "src/app/contact/awesome.pipe.ts", - "src/app/contact/contact.component.3.ts", - "src/app/contact/contact.module.2.ts", - "src/app/contact/contact-highlight.directive.ts", - - "src/main.2.ts", - "src/styles.css", - "src/index.2.html" - ], - "main": "src/index.2.html", - "tags": ["NgModule"] -} diff --git a/aio/content/examples/ngmodule-faq/e2e/src/app.e2e-spec.ts b/aio/content/examples/ngmodule-faq/e2e/src/app.e2e-spec.ts deleted file mode 100644 index 72d1ca9214..0000000000 --- a/aio/content/examples/ngmodule-faq/e2e/src/app.e2e-spec.ts +++ /dev/null @@ -1,223 +0,0 @@ -'use strict'; // necessary for es6 output in node - -import { browser, element, by } from 'protractor'; - -describe('NgModule', function () { - - // helpers - const gold = 'rgba(255, 215, 0, 1)'; - const powderblue = 'rgba(176, 224, 230, 1)'; - const lightgray = 'rgba(211, 211, 211, 1)'; - const white = 'rgba(0, 0, 0, 0)'; - - function getCommonsSectionStruct() { - const buttons = element.all(by.css('nav a')); - - return { - title: element.all(by.tagName('h1')).get(0), - welcome: element.all(by.css('app-title p i')).get(0), - contactButton: buttons.get(0), - crisisButton: buttons.get(1), - heroesButton: buttons.get(2) - }; - } - - function getContactSectionStruct() { - const buttons = element.all(by.css('app-contact form button')); - - return { - header: element.all(by.css('app-contact h2')).get(0), - popupMessage: element.all(by.css('app-contact div')).get(0), - contactNameHeader: element.all(by.css('app-contact form h3')).get(0), - input: element.all(by.css('app-contact form input')).get(0), - validationError: element.all(by.css('app-contact form .alert')).get(0), - saveButton: buttons.get(0), // can't be tested - nextContactButton: buttons.get(1), - newContactButton: buttons.get(2) - }; - } - - function getCrisisSectionStruct() { - return { - title: element.all(by.css('ng-component h3')).get(0), - items: element.all(by.css('ng-component a')), - itemId: element.all(by.css('ng-component div')).get(0), - listLink: element.all(by.css('ng-component a')).get(0), - }; - } - - function getHeroesSectionStruct() { - return { - header: element.all(by.css('ng-component h2')).get(0), - title: element.all(by.css('ng-component h3')).get(0), - items: element.all(by.css('ng-component a')), - itemId: element.all(by.css('ng-component ng-component div div')).get(0), - itemInput: element.all(by.css('ng-component ng-component input')).get(0), - listLink: element.all(by.css('ng-component ng-component a')).get(0), - }; - } - - // tests - function appTitleTests(color: string, name?: string) { - return function() { - it('should have a gray header', function() { - const commons = getCommonsSectionStruct(); - expect(commons.title.getCssValue('backgroundColor')).toBe(color); - }); - - it('should welcome us', function () { - const commons = getCommonsSectionStruct(); - expect(commons.welcome.getText()).toBe('Welcome, ' + (name || 'Sherlock Holmes')); - }); - }; - } - - function contactTests(color: string, name?: string) { - return function() { - it('shows the contact\'s owner', function() { - const contacts = getContactSectionStruct(); - expect(contacts.header.getText()).toBe('Contact of ' + (name || 'Sherlock Holmes')); - }); - - it('can cycle between contacts', function () { - const contacts = getContactSectionStruct(); - const nextButton = contacts.nextContactButton; - expect(contacts.contactNameHeader.getText()).toBe('Awesome Sam Spade'); - expect(contacts.contactNameHeader.getCssValue('backgroundColor')).toBe(color); - nextButton.click().then(function () { - expect(contacts.contactNameHeader.getText()).toBe('Awesome Nick Danger'); - return nextButton.click(); - }).then(function () { - expect(contacts.contactNameHeader.getText()).toBe('Awesome Nancy Drew'); - }); - }); - - it('can change an existing contact', function () { - const contacts = getContactSectionStruct(); - contacts.input.sendKeys('a'); - expect(contacts.input.getCssValue('backgroundColor')).toBe(color); - expect(contacts.contactNameHeader.getText()).toBe('Awesome Sam Spadea'); - }); - - it('can create a new contact', function () { - const contacts = getContactSectionStruct(); - const newContactButton = contacts.newContactButton; - newContactButton.click().then(function () { - expect(contacts.validationError.getText()).toBe('Name is required'); - contacts.input.sendKeys('John Doe'); - expect(contacts.contactNameHeader.getText()).toBe('Awesome John Doe'); - expect(contacts.validationError.getText()).toBe(''); - }); - }); - }; - } - - describe('index.html', function () { - beforeEach(function () { - browser.get(''); - }); - - describe('app-title', appTitleTests(white, 'Miss Marple')); - - describe('contact', contactTests(lightgray, 'Miss Marple')); - - describe('crisis center', function () { - beforeEach(function () { - getCommonsSectionStruct().crisisButton.click(); - }); - - it('shows a list of crisis', function () { - const crisis = getCrisisSectionStruct(); - expect(crisis.title.getText()).toBe('Crisis List'); - expect(crisis.items.count()).toBe(4); - expect(crisis.items.get(0).getText()).toBe('1 - Dragon Burning Cities'); - }); - - it('can navigate to one crisis details', function () { - const crisis = getCrisisSectionStruct(); - crisis.items.get(0).click().then(function() { - expect(crisis.itemId.getText()).toBe('Crisis id: 1'); - return crisis.listLink.click(); - }).then(function () { - // We are back to the list - expect(crisis.items.count()).toBe(4); - }); - }); - }); - - describe('heroes', function () { - beforeEach(function () { - getCommonsSectionStruct().heroesButton.click(); - }); - - it('shows a list of heroes', function() { - const heroes = getHeroesSectionStruct(); - expect(heroes.header.getText()).toBe('Heroes of Miss Marple'); - expect(heroes.title.getText()).toBe('Hero List'); - expect(heroes.items.count()).toBe(6); - expect(heroes.items.get(0).getText()).toBe('11 - Mr. Nice'); - }); - - it('can navigate and edit one hero details', function () { - const heroes = getHeroesSectionStruct(); - heroes.items.get(0).click().then(function () { - expect(heroes.itemId.getText()).toBe('Id: 11'); - heroes.itemInput.sendKeys(' try'); - return heroes.listLink.click(); - }).then(function () { - // We are back to the list - expect(heroes.items.count()).toBe(6); - expect(heroes.items.get(0).getText()).toBe('11 - Mr. Nice try'); - }); - }); - }); - }); - - // describe('index.0.html', function() { - // beforeEach(function () { - // browser.get('index.0.html'); - // }); - - // it('has a title', function () { - // const title = element.all(by.tagName('h1')).get(0); - // expect(title.getText()).toBe('Minimal NgModule'); - // }); - // }); - - // describe('index.1.html', function () { - // beforeEach(function () { - // browser.get('index.1.html'); - // }); - - // describe('app-title', appTitleTests(powderblue)); - // }); - - // describe('index.1b.html', function () { - // beforeEach(function () { - // browser.get('index.1b.html'); - // }); - - // describe('app-title', appTitleTests(powderblue)); - - // describe('contact', contactTests(powderblue)); - // }); - - // describe('index.2.html', function () { - // beforeEach(function () { - // browser.get('index.2.html'); - // }); - - // describe('app-title', appTitleTests(gold)); - - // describe('contact', contactTests(powderblue)); - // }); - - // describe('index.3.html', function () { - // beforeEach(function () { - // browser.get('index.3.html'); - // }); - - // describe('app-title', appTitleTests(gold)); - // }); - -}); diff --git a/aio/content/examples/ngmodule-faq/example-config.json b/aio/content/examples/ngmodule-faq/example-config.json deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/aio/content/examples/ngmodule-faq/minimal.0.stackblitz.json b/aio/content/examples/ngmodule-faq/minimal.0.stackblitz.json deleted file mode 100644 index c1835325d8..0000000000 --- a/aio/content/examples/ngmodule-faq/minimal.0.stackblitz.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "description": "Minimal NgModule", - "files": [ - "src/app/app.component.0.ts", - "src/app/app.module.0.ts", - "src/main.0.ts", - "src/styles.css", - "src/index.0.html" - ], - "main": "src/index.0.html", - "tags": ["NgModule"] -} diff --git a/aio/content/examples/ngmodule-faq/pre-shared.3.stackblitz.json b/aio/content/examples/ngmodule-faq/pre-shared.3.stackblitz.json deleted file mode 100644 index 39faaf229e..0000000000 --- a/aio/content/examples/ngmodule-faq/pre-shared.3.stackblitz.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "description": "NgModule v.3", - "files": [ - "src/app/app.component.3.ts", - "src/app/app.module.3.ts", - "src/app/app-routing.module.3.ts", - - "src/app/highlight.directive.ts", - "src/app/title.component.html", - "src/app/title.component.ts", - "src/app/user.service.ts", - - "src/app/contact/contact.component.css", - "src/app/contact/contact.component.html", - "src/app/contact/contact.service.ts", - - "src/app/contact/awesome.pipe.ts", - "src/app/contact/contact.component.3.ts", - "src/app/contact/contact.module.3.ts", - "src/app/contact/contact-routing.module.3.ts", - "src/app/contact/contact-highlight.directive.ts", - - "src/app/crisis/*.ts", - - "src/app/hero/hero-detail.component.ts", - "src/app/hero/hero-list.component.ts", - "src/app/hero/hero.service.ts", - - "src/app/hero/hero.component.3.ts", - "src/app/hero/hero.module.3.ts", - "src/app/hero/hero-routing.module.3.ts", - "src/app/hero/highlight.directive.ts", - - "src/main.3.ts", - "src/styles.css", - "src/index.3.html" - ], - "main": "src/index.3.html", - "tags": ["NgModule"] -} diff --git a/aio/content/examples/ngmodule-faq/src/app/app-routing.module.3.ts b/aio/content/examples/ngmodule-faq/src/app/app-routing.module.3.ts deleted file mode 100644 index 573e30ed11..0000000000 --- a/aio/content/examples/ngmodule-faq/src/app/app-routing.module.3.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { NgModule } from '@angular/core'; -import { Routes, RouterModule } from '@angular/router'; - -import { ContactModule } from './contact/contact.module.3'; - -const routes: Routes = [ - { path: '', redirectTo: 'contact', pathMatch: 'full'}, - { path: 'crisis', loadChildren: './crisis/crisis.module#CrisisModule' }, - { path: 'heroes', loadChildren: './hero/hero.module.3#HeroModule' } -]; - -@NgModule({ - imports: [ - ContactModule, - RouterModule.forRoot(routes) - ], - exports: [RouterModule] -}) -export class AppRoutingModule {} diff --git a/aio/content/examples/ngmodule-faq/src/app/app-routing.module.ts b/aio/content/examples/ngmodule-faq/src/app/app-routing.module.ts deleted file mode 100644 index de16e8e6e6..0000000000 --- a/aio/content/examples/ngmodule-faq/src/app/app-routing.module.ts +++ /dev/null @@ -1,30 +0,0 @@ -// #docregion -import { NgModule } from '@angular/core'; -import { Routes, RouterModule } from '@angular/router'; - -import { ContactModule } from './contact/contact.module'; - -// #docregion routes -const routes: Routes = [ - { path: '', redirectTo: 'contact', pathMatch: 'full'}, - // #docregion lazy-routes - { path: 'crisis', loadChildren: './crisis/crisis.module#CrisisModule' }, - { path: 'heroes', loadChildren: './hero/hero.module#HeroModule' } - // #enddocregion lazy-routes -]; -// #enddocregion routes - -@NgModule({ - // #docregion imports - imports: [ - ContactModule, - // #docregion forRoot - RouterModule.forRoot(routes), - // #enddocregion forRoot - ], - // #enddocregion imports - // #docregion exports - exports: [RouterModule] - // #enddocregion exports -}) -export class AppRoutingModule {} diff --git a/aio/content/examples/ngmodule-faq/src/app/app.component.0.ts b/aio/content/examples/ngmodule-faq/src/app/app.component.0.ts deleted file mode 100644 index 9aac868764..0000000000 --- a/aio/content/examples/ngmodule-faq/src/app/app.component.0.ts +++ /dev/null @@ -1,10 +0,0 @@ -// #docregion -import { Component } from '@angular/core'; - -@Component({ - selector: 'app-root', - template: '

{{title}}

', -}) -export class AppComponent { - title = 'Angular Modules'; -} diff --git a/aio/content/examples/ngmodule-faq/src/app/app.component.1.ts b/aio/content/examples/ngmodule-faq/src/app/app.component.1.ts deleted file mode 100644 index 6cdf540f0e..0000000000 --- a/aio/content/examples/ngmodule-faq/src/app/app.component.1.ts +++ /dev/null @@ -1,17 +0,0 @@ -// #docplaster -// #docregion -import { Component } from '@angular/core'; - -@Component({ - selector: 'app-root', -// #enddocregion - /* - // #docregion template - template: '

{{title}}

' - // #enddocregion template - */ -// #docregion - template: '' -}) -export class AppComponent {} -// #enddocregion diff --git a/aio/content/examples/ngmodule-faq/src/app/app.component.1b.ts b/aio/content/examples/ngmodule-faq/src/app/app.component.1b.ts deleted file mode 100644 index 36e3005e0a..0000000000 --- a/aio/content/examples/ngmodule-faq/src/app/app.component.1b.ts +++ /dev/null @@ -1,13 +0,0 @@ -// #docregion -import { Component } from '@angular/core'; - -@Component({ - selector: 'app-root', - // #docregion template - template: ` - - - ` - // #enddocregion template -}) -export class AppComponent {} diff --git a/aio/content/examples/ngmodule-faq/src/app/app.component.2.ts b/aio/content/examples/ngmodule-faq/src/app/app.component.2.ts deleted file mode 100644 index f28e4526e9..0000000000 --- a/aio/content/examples/ngmodule-faq/src/app/app.component.2.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { Component } from '@angular/core'; - -@Component({ - selector: 'app-root', - template: ` - - - ` -}) -export class AppComponent {} diff --git a/aio/content/examples/ngmodule-faq/src/app/app.component.3.ts b/aio/content/examples/ngmodule-faq/src/app/app.component.3.ts deleted file mode 100644 index cab904e656..0000000000 --- a/aio/content/examples/ngmodule-faq/src/app/app.component.3.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { Component } from '@angular/core'; - -@Component({ - selector: 'app-root', - // #docregion template - template: ` - - - - ` - // #enddocregion template -}) -export class AppComponent {} diff --git a/aio/content/examples/ngmodule-faq/src/app/app.component.ts b/aio/content/examples/ngmodule-faq/src/app/app.component.ts deleted file mode 100644 index 4011f82b0c..0000000000 --- a/aio/content/examples/ngmodule-faq/src/app/app.component.ts +++ /dev/null @@ -1,17 +0,0 @@ -// #docplaster -// #docregion -import { Component } from '@angular/core'; - -@Component({ - selector: 'app-root', - template: ` - - - - ` -}) -export class AppComponent {} diff --git a/aio/content/examples/ngmodule-faq/src/app/app.module.0.ts b/aio/content/examples/ngmodule-faq/src/app/app.module.0.ts deleted file mode 100644 index 4cce82ffcf..0000000000 --- a/aio/content/examples/ngmodule-faq/src/app/app.module.0.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { NgModule } from '@angular/core'; -import { BrowserModule } from '@angular/platform-browser'; - -import { AppComponent } from './app.component.0'; - -@NgModule({ -// #docregion imports - imports: [ BrowserModule ], -// #enddocregion imports - declarations: [ AppComponent ], - bootstrap: [ AppComponent ] -}) -export class AppModule { } diff --git a/aio/content/examples/ngmodule-faq/src/app/app.module.1.ts b/aio/content/examples/ngmodule-faq/src/app/app.module.1.ts deleted file mode 100644 index bb0f7ec6f9..0000000000 --- a/aio/content/examples/ngmodule-faq/src/app/app.module.1.ts +++ /dev/null @@ -1,52 +0,0 @@ -// #docplaster -// #docregion -/* Angular Imports */ -import { NgModule } from '@angular/core'; -import { BrowserModule } from '@angular/platform-browser'; - -/* App Imports */ -// #enddocregion -import { AppComponent } from './app.component.1'; -/* -// #docregion -import { AppComponent } from './app.component'; -// #enddocregion -*/ -// #docregion -import { HighlightDirective } from './highlight.directive'; -import { TitleComponent } from './title.component'; -import { UserService } from './user.service'; - -/* Contact Related Imports */ -import { FormsModule } from '@angular/forms'; - -import { AwesomePipe } from './contact/awesome.pipe'; -import { ContactComponent } from './contact/contact.component.3'; -import { - ContactHighlightDirective as ContactHighlightDirective -} from './contact/contact-highlight.directive'; - -@NgModule({ -// #docregion imports - imports: [ BrowserModule, FormsModule ], -// #enddocregion imports -// #docregion declarations, directive, component - declarations: [ - AppComponent, - HighlightDirective, -// #enddocregion directive - TitleComponent, -// #enddocregion component - - AwesomePipe, - ContactComponent, - ContactHighlightDirective -// #docregion directive, component - ], -// #enddocregion declarations, directive, component -// #docregion providers - providers: [ UserService ], -// #enddocregion providers - bootstrap: [ AppComponent ] -}) -export class AppModule { } diff --git a/aio/content/examples/ngmodule-faq/src/app/app.module.1b.ts b/aio/content/examples/ngmodule-faq/src/app/app.module.1b.ts deleted file mode 100644 index 9c848aec30..0000000000 --- a/aio/content/examples/ngmodule-faq/src/app/app.module.1b.ts +++ /dev/null @@ -1,46 +0,0 @@ -// #docplaster -// #docregion -/* Angular Imports */ -import { NgModule } from '@angular/core'; -import { BrowserModule } from '@angular/platform-browser'; -import { FormsModule } from '@angular/forms'; - -/* App Imports */ -// #enddocregion -import { AppComponent } from './app.component.1b'; -/* -// #docregion -import { AppComponent } from './app.component'; -// #enddocregion -*/ -// #docregion -import { HighlightDirective } from './highlight.directive'; -import { TitleComponent } from './title.component'; -import { UserService } from './user.service'; - -/* Contact Imports */ -// #enddocregion -import { ContactComponent } from './contact/contact.component.3'; -/* -// #docregion -import { ContactComponent } from './contact/contact.component'; -// #enddocregion -*/ -// #docregion -import { AwesomePipe } from './contact/awesome.pipe'; -import { ContactService } from './contact/contact.service'; -import { ContactHighlightDirective } from './contact/contact-highlight.directive'; - -@NgModule({ - imports: [ BrowserModule, FormsModule ], -// #docregion declarations - declarations: [ - AppComponent, HighlightDirective, TitleComponent, - AwesomePipe, ContactComponent, ContactHighlightDirective - ], -// #docregion providers - providers: [ ContactService, UserService ], -// #enddocregion providers - bootstrap: [ AppComponent ] -}) -export class AppModule { } diff --git a/aio/content/examples/ngmodule-faq/src/app/app.module.2.ts b/aio/content/examples/ngmodule-faq/src/app/app.module.2.ts deleted file mode 100644 index 0da0fe334f..0000000000 --- a/aio/content/examples/ngmodule-faq/src/app/app.module.2.ts +++ /dev/null @@ -1,36 +0,0 @@ -// #docplaster -// #docregion -/* Angular Imports */ -import { NgModule } from '@angular/core'; -import { BrowserModule } from '@angular/platform-browser'; - -/* App Imports */ -// #enddocregion -import { AppComponent } from './app.component.2'; -/* -// #docregion -import { AppComponent } from './app.component'; -// #enddocregion -*/ -// #docregion -import { HighlightDirective } from './highlight.directive'; -import { TitleComponent } from './title.component'; -import { UserService } from './user.service'; - -/* Contact Imports */ -// #enddocregion -import { ContactModule } from './contact/contact.module.2'; -/* -// #docregion -import { ContactModule } from './contact/contact.module'; -// #enddocregion -*/ -// #docregion - -@NgModule({ - imports: [ BrowserModule, ContactModule ], - declarations: [ AppComponent, HighlightDirective, TitleComponent ], - providers: [ UserService ], - bootstrap: [ AppComponent ], -}) -export class AppModule { } diff --git a/aio/content/examples/ngmodule-faq/src/app/app.module.ts b/aio/content/examples/ngmodule-faq/src/app/app.module.ts deleted file mode 100644 index c75c445a58..0000000000 --- a/aio/content/examples/ngmodule-faq/src/app/app.module.ts +++ /dev/null @@ -1,39 +0,0 @@ -// #docplaster -// #docregion -// #docregion v4 -/* Angular Imports */ -import { NgModule } from '@angular/core'; -import { BrowserModule } from '@angular/platform-browser'; - -/* App Imports */ -import { AppComponent } from './app.component'; - -/* Core Modules */ -import { CoreModule } from './core/core.module'; - -/* Routing Module */ -import { AppRoutingModule } from './app-routing.module'; - -@NgModule({ - // #docregion import-for-root - imports: [ - BrowserModule, -// #enddocregion v4 -// #enddocregion import-for-root -/* -// #docregion v4 - CoreModule, -// #enddocregion v4 -*/ -// #docregion import-for-root - CoreModule.forRoot({userName: 'Miss Marple'}), -// #docregion v4 - AppRoutingModule - ], - // #enddocregion import-for-root - declarations: [ AppComponent ], - bootstrap: [ AppComponent ] -}) -export class AppModule { } -// #enddocregion v4 -// #enddocregion diff --git a/aio/content/examples/ngmodule-faq/src/app/contact/contact-routing.module.3.ts b/aio/content/examples/ngmodule-faq/src/app/contact/contact-routing.module.3.ts deleted file mode 100644 index d89119a156..0000000000 --- a/aio/content/examples/ngmodule-faq/src/app/contact/contact-routing.module.3.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { NgModule } from '@angular/core'; -import { RouterModule } from '@angular/router'; - -import { ContactComponent } from './contact.component.3'; - -const routes = [ - { path: 'contact', component: ContactComponent} -]; - -@NgModule({ - imports: [ RouterModule.forChild(routes) ], - exports: [ RouterModule ] -}) -export class ContactRoutingModule {} diff --git a/aio/content/examples/ngmodule-faq/src/app/contact/contact-routing.module.ts b/aio/content/examples/ngmodule-faq/src/app/contact/contact-routing.module.ts deleted file mode 100644 index 46dd15867e..0000000000 --- a/aio/content/examples/ngmodule-faq/src/app/contact/contact-routing.module.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { NgModule } from '@angular/core'; -import { RouterModule } from '@angular/router'; - -import { ContactComponent } from './contact.component'; - -// #docregion routing -const routes = [ - { path: 'contact', component: ContactComponent} -]; - -@NgModule({ - imports: [ RouterModule.forChild(routes) ], - exports: [ RouterModule ] -}) -export class ContactRoutingModule {} -// #enddocregion diff --git a/aio/content/examples/ngmodule-faq/src/app/contact/contact.component.3.ts b/aio/content/examples/ngmodule-faq/src/app/contact/contact.component.3.ts deleted file mode 100644 index e674ec1323..0000000000 --- a/aio/content/examples/ngmodule-faq/src/app/contact/contact.component.3.ts +++ /dev/null @@ -1,53 +0,0 @@ -// #docregion -import { Component, OnInit } from '@angular/core'; - -import { Contact, ContactService } from './contact.service'; -import { UserService } from '../user.service'; - -@Component({ - selector: 'app-contact', - templateUrl: './contact.component.html', - styleUrls: [ './contact.component.css' ] -}) -export class ContactComponent implements OnInit { - contact: Contact; - contacts: Contact[]; - - msg = 'Loading contacts ...'; - userName = ''; - - constructor(private contactService: ContactService, userService: UserService) { - this.userName = userService.userName; - } - - ngOnInit() { - this.contactService.getContacts().subscribe(contacts => { - this.msg = ''; - this.contacts = contacts; - this.contact = contacts[0]; - }); - } - - next() { - let ix = 1 + this.contacts.indexOf(this.contact); - if (ix >= this.contacts.length) { ix = 0; } - this.contact = this.contacts[ix]; - } - - onSubmit() { - // POST-DEMO TODO: do something like save it - this.displayMessage('Saved ' + this.contact.name); - } - - newContact() { - this.displayMessage('New contact'); - this.contact = {id: 42, name: ''}; - this.contacts.push(this.contact); - } - - /** Display a message briefly, then remove it. */ - displayMessage(msg: string) { - this.msg = msg; - setTimeout(() => this.msg = '', 1500); - } -} diff --git a/aio/content/examples/ngmodule-faq/src/app/contact/contact.component.css b/aio/content/examples/ngmodule-faq/src/app/contact/contact.component.css deleted file mode 100644 index d5bd954dde..0000000000 --- a/aio/content/examples/ngmodule-faq/src/app/contact/contact.component.css +++ /dev/null @@ -1,32 +0,0 @@ -/* #docregion */ -.ng-valid[required] { - border-left: 5px solid #42A948; /* green */ -} - -.ng-invalid { - border-left: 5px solid #a94442; /* red */ -} - -.alert { - padding: 15px; - margin: 8px 0; - border: 1px solid transparent; - border-radius: 4px; -} -.alert-danger { - color: #a94442; - background-color: #f2dede; - border-color: #ebccd1; -} - -.msg { - color: blue; - background-color: whitesmoke; - border: 1px solid transparent; - border-radius: 4px; - margin-bottom: 20px; -} - -.button-group { - padding-top: 12px; -} diff --git a/aio/content/examples/ngmodule-faq/src/app/contact/contact.component.html b/aio/content/examples/ngmodule-faq/src/app/contact/contact.component.html deleted file mode 100644 index ecd5e62169..0000000000 --- a/aio/content/examples/ngmodule-faq/src/app/contact/contact.component.html +++ /dev/null @@ -1,37 +0,0 @@ - -

Contact of {{userName}}

-
{{msg}}
- -
- -

{{ contact.name | awesome }}

- - -
- - - - - - -
- Name is required -
-
- -
- - - - - -
-
- diff --git a/aio/content/examples/ngmodule-faq/src/app/contact/contact.component.ts b/aio/content/examples/ngmodule-faq/src/app/contact/contact.component.ts deleted file mode 100644 index 7fa44eebe5..0000000000 --- a/aio/content/examples/ngmodule-faq/src/app/contact/contact.component.ts +++ /dev/null @@ -1,54 +0,0 @@ -// Exact copy except import UserService from core -// #docregion -import { Component, OnInit } from '@angular/core'; - -import { Contact, ContactService } from './contact.service'; -import { UserService } from '../core/user.service'; - -@Component({ - selector: 'app-contact', - templateUrl: './contact.component.html', - styleUrls: [ './contact.component.css' ] -}) -export class ContactComponent implements OnInit { - contact: Contact; - contacts: Contact[]; - - msg = 'Loading contacts ...'; - userName = ''; - - constructor(private contactService: ContactService, userService: UserService) { - this.userName = userService.userName; - } - - ngOnInit() { - this.contactService.getContacts().subscribe(contacts => { - this.msg = ''; - this.contacts = contacts; - this.contact = contacts[0]; - }); - } - - next() { - let ix = 1 + this.contacts.indexOf(this.contact); - if (ix >= this.contacts.length) { ix = 0; } - this.contact = this.contacts[ix]; - } - - onSubmit() { - // POST-DEMO TODO: do something like save it - this.displayMessage('Saved ' + this.contact.name); - } - - newContact() { - this.displayMessage('New contact'); - this.contact = {id: 42, name: ''}; - this.contacts.push(this.contact); - } - - /** Display a message briefly, then remove it. */ - displayMessage(msg: string) { - this.msg = msg; - setTimeout(() => this.msg = '', 1500); - } -} diff --git a/aio/content/examples/ngmodule-faq/src/app/contact/contact.module.0.ts b/aio/content/examples/ngmodule-faq/src/app/contact/contact.module.0.ts deleted file mode 100644 index fe2a756bd4..0000000000 --- a/aio/content/examples/ngmodule-faq/src/app/contact/contact.module.0.ts +++ /dev/null @@ -1,11 +0,0 @@ -// #docregion -import { NgModule } from '@angular/core'; -import { CommonModule } from '@angular/common'; - -@NgModule({ - imports: [ - CommonModule - ], - declarations: [] -}) -export class ContactModule { } diff --git a/aio/content/examples/ngmodule-faq/src/app/contact/contact.module.2.ts b/aio/content/examples/ngmodule-faq/src/app/contact/contact.module.2.ts deleted file mode 100644 index d83a26cd78..0000000000 --- a/aio/content/examples/ngmodule-faq/src/app/contact/contact.module.2.ts +++ /dev/null @@ -1,37 +0,0 @@ -// #docplaster -// #docregion -import { NgModule } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { FormsModule } from '@angular/forms'; - -import { AwesomePipe } from './awesome.pipe'; -// #enddocregion -import { ContactComponent } from './contact.component.3'; -/* -// #docregion -import { ContactComponent } from './contact.component'; -// #enddocregion -*/ -// #docregion -import { ContactHighlightDirective } from './contact-highlight.directive'; -import { ContactService } from './contact.service'; - -// #docregion class -@NgModule({ - imports: [ - CommonModule, - FormsModule - ], - declarations: [ - AwesomePipe, - ContactComponent, - ContactHighlightDirective - ], - // #docregion exports - exports: [ ContactComponent ], - // #enddocregion exports - providers: [ ContactService ] -}) -export class ContactModule { } -// #enddocregion class -// #enddocregion diff --git a/aio/content/examples/ngmodule-faq/src/app/contact/contact.module.3.ts b/aio/content/examples/ngmodule-faq/src/app/contact/contact.module.3.ts deleted file mode 100644 index 3af9732e76..0000000000 --- a/aio/content/examples/ngmodule-faq/src/app/contact/contact.module.3.ts +++ /dev/null @@ -1,44 +0,0 @@ -// #docplaster -// #docregion -import { NgModule } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { FormsModule } from '@angular/forms'; - -import { AwesomePipe } from './awesome.pipe'; -// #enddocregion -import { ContactComponent } from './contact.component.3'; -/* -// #docregion -import { ContactComponent } from './contact.component'; -// #enddocregion -*/ -// #docregion -import { ContactHighlightDirective } from './contact-highlight.directive'; -import { ContactService } from './contact.service'; - -// #enddocregion -import { ContactRoutingModule } from './contact-routing.module.3'; -/* -// #docregion -import { ContactRoutingModule } from './contact-routing.module'; -// #enddocregion -*/ -// #docregion - -// #docregion class -@NgModule({ - imports: [ - CommonModule, - FormsModule, - ContactRoutingModule - ], - declarations: [ - AwesomePipe, - ContactComponent, - ContactHighlightDirective - ], - providers: [ ContactService ] -}) -export class ContactModule { } -// #enddocregion class -// #enddocregion diff --git a/aio/content/examples/ngmodule-faq/src/app/contact/contact.module.ts b/aio/content/examples/ngmodule-faq/src/app/contact/contact.module.ts deleted file mode 100644 index 883331dfba..0000000000 --- a/aio/content/examples/ngmodule-faq/src/app/contact/contact.module.ts +++ /dev/null @@ -1,19 +0,0 @@ -// #docregion -import { NgModule } from '@angular/core'; -import { SharedModule } from '../shared/shared.module'; - -import { ContactComponent } from './contact.component'; -import { ContactService } from './contact.service'; -import { ContactRoutingModule } from './contact-routing.module'; - -// #docregion class -@NgModule({ - imports: [ - SharedModule, - ContactRoutingModule - ], - declarations: [ ContactComponent ], - providers: [ ContactService ] -}) -export class ContactModule { } -// #enddocregion class diff --git a/aio/content/examples/ngmodule-faq/src/app/contact/contact.service.ts b/aio/content/examples/ngmodule-faq/src/app/contact/contact.service.ts deleted file mode 100644 index ff21a65bce..0000000000 --- a/aio/content/examples/ngmodule-faq/src/app/contact/contact.service.ts +++ /dev/null @@ -1,37 +0,0 @@ -// #docplaster -// #docregion -import { Injectable, OnDestroy } from '@angular/core'; - -import { Observable, of } from 'rxjs'; -import { delay } from 'rxjs/operators'; - -export class Contact { - constructor(public id: number, public name: string) { } -} - -const CONTACTS: Contact[] = [ - new Contact(21, 'Sam Spade'), - new Contact(22, 'Nick Danger'), - new Contact(23, 'Nancy Drew') -]; - -const FETCH_LATENCY = 500; - -/** Simulate a data service that retrieves contacts from a server */ -@Injectable() -export class ContactService implements OnDestroy { -// #enddocregion - constructor() { console.log('ContactService instance created.'); } - ngOnDestroy() { console.log('ContactService instance destroyed.'); } - -// #docregion - getContacts(): Observable { - return of(CONTACTS).pipe(delay(FETCH_LATENCY)); - } - - getContact(id: number | string): Observable { - return of(CONTACTS.find(contact => contact.id === +id)) - .pipe(delay(FETCH_LATENCY)); - } -} -// #enddocregion diff --git a/aio/content/examples/ngmodule-faq/src/app/core/core.module.ts b/aio/content/examples/ngmodule-faq/src/app/core/core.module.ts deleted file mode 100644 index 27cb9a2193..0000000000 --- a/aio/content/examples/ngmodule-faq/src/app/core/core.module.ts +++ /dev/null @@ -1,48 +0,0 @@ -/* tslint:disable:member-ordering no-unused-variable */ -// #docplaster -// #docregion -// #docregion v4 -import { - ModuleWithProviders, NgModule, - Optional, SkipSelf } from '@angular/core'; - -import { CommonModule } from '@angular/common'; - -import { TitleComponent } from './title.component'; -import { UserService } from './user.service'; -// #enddocregion -import { UserServiceConfig } from './user.service'; - -// #docregion v4 -@NgModule({ - imports: [ CommonModule ], - declarations: [ TitleComponent ], - exports: [ TitleComponent ], - providers: [ UserService ] -}) -export class CoreModule { -// #enddocregion v4 - - // #docregion ctor - constructor (@Optional() @SkipSelf() parentModule: CoreModule) { - if (parentModule) { - throw new Error( - 'CoreModule is already loaded. Import it in the AppModule only'); - } - } - // #enddocregion ctor - - // #docregion for-root - static forRoot(config: UserServiceConfig): ModuleWithProviders { - return { - ngModule: CoreModule, - providers: [ - {provide: UserServiceConfig, useValue: config } - ] - }; - } - // #enddocregion for-root -// #docregion v4 -} -// #enddocregion v4 -// #enddocregion diff --git a/aio/content/examples/ngmodule-faq/src/app/core/title.component.html b/aio/content/examples/ngmodule-faq/src/app/core/title.component.html deleted file mode 100644 index be114caa73..0000000000 --- a/aio/content/examples/ngmodule-faq/src/app/core/title.component.html +++ /dev/null @@ -1,6 +0,0 @@ - -

{{title}}

-

- Welcome, {{user}} -

- diff --git a/aio/content/examples/ngmodule-faq/src/app/core/title.component.ts b/aio/content/examples/ngmodule-faq/src/app/core/title.component.ts deleted file mode 100644 index 51d9c242db..0000000000 --- a/aio/content/examples/ngmodule-faq/src/app/core/title.component.ts +++ /dev/null @@ -1,16 +0,0 @@ -// Exact copy of app/title.component.ts except import UserService from shared -import { Component, Input } from '@angular/core'; -import { UserService } from '../core/user.service'; - -@Component({ - selector: 'app-title', - templateUrl: './title.component.html', -}) -export class TitleComponent { - title = 'Angular Modules'; - user = ''; - - constructor(userService: UserService) { - this.user = userService.userName; - } -} diff --git a/aio/content/examples/ngmodule-faq/src/app/core/user.service.ts b/aio/content/examples/ngmodule-faq/src/app/core/user.service.ts deleted file mode 100644 index 8fe839075e..0000000000 --- a/aio/content/examples/ngmodule-faq/src/app/core/user.service.ts +++ /dev/null @@ -1,32 +0,0 @@ -// Crazy copy of the app/user.service -// Proves that UserService is an app-wide singleton and only instantiated once -// IFF shared.module follows the `forRoot` pattern -// -// If it didn't, a new instance of UserService would be created -// after each lazy load and the userName would double up. - -import { Injectable, Optional } from '@angular/core'; - -let nextId = 1; - -export class UserServiceConfig { - userName = 'Philip Marlowe'; -} - -@Injectable() -export class UserService { - id = nextId++; - private _userName = 'Sherlock Holmes'; - - // #docregion ctor - constructor(@Optional() config: UserServiceConfig) { - if (config) { this._userName = config.userName; } - } - // #enddocregion ctor - - get userName() { - // Demo: add a suffix if this service has been created more than once - const suffix = this.id > 1 ? ` times ${this.id}` : ''; - return this._userName + suffix; - } -} diff --git a/aio/content/examples/ngmodule-faq/src/app/crisis/crisis-detail.component.ts b/aio/content/examples/ngmodule-faq/src/app/crisis/crisis-detail.component.ts deleted file mode 100644 index 30a1d0e7bf..0000000000 --- a/aio/content/examples/ngmodule-faq/src/app/crisis/crisis-detail.component.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { Component, OnInit } from '@angular/core'; -import { ActivatedRoute } from '@angular/router'; - -@Component({ - template: ` -

Crisis Detail

-
Crisis id: {{id}}
-
- Crisis List - ` -}) -export class CrisisDetailComponent implements OnInit { - id: number; - constructor(private route: ActivatedRoute) { } - - ngOnInit() { - this.id = parseInt(this.route.snapshot.paramMap.get('id'), 10); - } -} diff --git a/aio/content/examples/ngmodule-faq/src/app/crisis/crisis-list.component.ts b/aio/content/examples/ngmodule-faq/src/app/crisis/crisis-list.component.ts deleted file mode 100644 index 858f749416..0000000000 --- a/aio/content/examples/ngmodule-faq/src/app/crisis/crisis-list.component.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { Component } from '@angular/core'; -import { Observable } from 'rxjs'; - -import { Crisis, - CrisisService } from './crisis.service'; - -@Component({ - template: ` -

Crisis List

-
- {{crisis.id}} - {{crisis.name}} -
- ` -}) -export class CrisisListComponent { - crises: Observable; - - constructor(private crisisService: CrisisService) { - this.crises = this.crisisService.getCrises(); - } -} diff --git a/aio/content/examples/ngmodule-faq/src/app/crisis/crisis-routing.module.ts b/aio/content/examples/ngmodule-faq/src/app/crisis/crisis-routing.module.ts deleted file mode 100644 index c60efa8cb4..0000000000 --- a/aio/content/examples/ngmodule-faq/src/app/crisis/crisis-routing.module.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { NgModule } from '@angular/core'; -import { Routes, - RouterModule } from '@angular/router'; - -import { CrisisListComponent } from './crisis-list.component'; -import { CrisisDetailComponent } from './crisis-detail.component'; - -const routes: Routes = [ - { path: '', redirectTo: 'list', pathMatch: 'full'}, - { path: 'list', component: CrisisListComponent }, - { path: ':id', component: CrisisDetailComponent } -]; - -@NgModule({ - imports: [RouterModule.forChild(routes)], - exports: [RouterModule] -}) -export class CrisisRoutingModule {} diff --git a/aio/content/examples/ngmodule-faq/src/app/crisis/crisis.module.ts b/aio/content/examples/ngmodule-faq/src/app/crisis/crisis.module.ts deleted file mode 100644 index f557bd6423..0000000000 --- a/aio/content/examples/ngmodule-faq/src/app/crisis/crisis.module.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { NgModule } from '@angular/core'; -import { CommonModule } from '@angular/common'; - -import { CrisisListComponent } from './crisis-list.component'; -import { CrisisDetailComponent } from './crisis-detail.component'; -import { CrisisService } from './crisis.service'; -import { CrisisRoutingModule } from './crisis-routing.module'; - -@NgModule({ - imports: [ CommonModule, CrisisRoutingModule ], - declarations: [ CrisisDetailComponent, CrisisListComponent ], - providers: [ CrisisService ] -}) -export class CrisisModule {} diff --git a/aio/content/examples/ngmodule-faq/src/app/crisis/crisis.service.ts b/aio/content/examples/ngmodule-faq/src/app/crisis/crisis.service.ts deleted file mode 100644 index f91eb995ea..0000000000 --- a/aio/content/examples/ngmodule-faq/src/app/crisis/crisis.service.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { Injectable, OnDestroy } from '@angular/core'; - -import { Observable, of } from 'rxjs'; -import { delay } from 'rxjs/operators'; - -export class Crisis { - constructor(public id: number, public name: string) { } -} - -const CRISES: Crisis[] = [ - new Crisis(1, 'Dragon Burning Cities'), - new Crisis(2, 'Sky Rains Great White Sharks'), - new Crisis(3, 'Giant Asteroid Heading For Earth'), - new Crisis(4, 'Procrastinators Meeting Delayed Again'), -]; - -const FETCH_LATENCY = 500; - -/** Simulate a data service that retrieves crises from a server */ -@Injectable() -export class CrisisService implements OnDestroy { - constructor() { console.log('CrisisService instance created.'); } - ngOnDestroy() { console.log('CrisisService instance destroyed.'); } - - getCrises(): Observable { - return of(CRISES).pipe(delay(FETCH_LATENCY)); - } - - getCrisis(id: number | string): Observable { - return of(CRISES.find(crisis => crisis.id === +id)) - .pipe(delay(FETCH_LATENCY)); - } -} diff --git a/aio/content/examples/ngmodule-faq/src/app/hero/hero-detail.component.ts b/aio/content/examples/ngmodule-faq/src/app/hero/hero-detail.component.ts deleted file mode 100644 index 2c46622bc4..0000000000 --- a/aio/content/examples/ngmodule-faq/src/app/hero/hero-detail.component.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { Component, OnInit } from '@angular/core'; -import { ActivatedRoute } from '@angular/router'; - -import { Hero, - HeroService } from './hero.service'; - -@Component({ - template: ` -

Hero Detail

-
-
Id: {{hero.id}}

- -
-
- Hero List - ` -}) -export class HeroDetailComponent implements OnInit { - hero: Hero; - - constructor( - private route: ActivatedRoute, - private heroService: HeroService) { } - - ngOnInit() { - let id = parseInt(this.route.snapshot.paramMap.get('id'), 10); - this.heroService.getHero(id).subscribe(hero => this.hero = hero); - } -} diff --git a/aio/content/examples/ngmodule-faq/src/app/hero/hero-list.component.ts b/aio/content/examples/ngmodule-faq/src/app/hero/hero-list.component.ts deleted file mode 100644 index 8ac492403e..0000000000 --- a/aio/content/examples/ngmodule-faq/src/app/hero/hero-list.component.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { Component } from '@angular/core'; -import { Observable } from 'rxjs'; - -import { Hero, - HeroService } from './hero.service'; - -@Component({ - template: ` -

Hero List

- - ` -}) -export class HeroListComponent { - heroes: Observable; - constructor(private heroService: HeroService) { - this.heroes = this.heroService.getHeroes(); - } -} diff --git a/aio/content/examples/ngmodule-faq/src/app/hero/hero-routing.module.3.ts b/aio/content/examples/ngmodule-faq/src/app/hero/hero-routing.module.3.ts deleted file mode 100644 index 588ffd94be..0000000000 --- a/aio/content/examples/ngmodule-faq/src/app/hero/hero-routing.module.3.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { NgModule } from '@angular/core'; -import { Routes, - RouterModule } from '@angular/router'; - -import { HeroComponent } from './hero.component.3'; -import { HeroListComponent } from './hero-list.component'; -import { HeroDetailComponent } from './hero-detail.component'; - -const routes: Routes = [ - { path: '', - component: HeroComponent, - children: [ - { path: '', component: HeroListComponent }, - { path: ':id', component: HeroDetailComponent } - ] - } -]; - -@NgModule({ - imports: [RouterModule.forChild(routes)], - exports: [RouterModule] -}) -export class HeroRoutingModule {} diff --git a/aio/content/examples/ngmodule-faq/src/app/hero/hero-routing.module.ts b/aio/content/examples/ngmodule-faq/src/app/hero/hero-routing.module.ts deleted file mode 100644 index d97aab3beb..0000000000 --- a/aio/content/examples/ngmodule-faq/src/app/hero/hero-routing.module.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { NgModule } from '@angular/core'; -import { Routes, - RouterModule } from '@angular/router'; - -import { HeroComponent } from './hero.component'; -import { HeroListComponent } from './hero-list.component'; -import { HeroDetailComponent } from './hero-detail.component'; - -const routes: Routes = [ - { path: '', - component: HeroComponent, - children: [ - { path: '', component: HeroListComponent }, - { path: ':id', component: HeroDetailComponent } - ] - } -]; - -@NgModule({ - imports: [RouterModule.forChild(routes)], - exports: [RouterModule] -}) -export class HeroRoutingModule {} diff --git a/aio/content/examples/ngmodule-faq/src/app/hero/hero.component.3.ts b/aio/content/examples/ngmodule-faq/src/app/hero/hero.component.3.ts deleted file mode 100644 index d52bc253df..0000000000 --- a/aio/content/examples/ngmodule-faq/src/app/hero/hero.component.3.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { Component } from '@angular/core'; - -import { HeroService } from './hero.service'; -import { UserService } from '../user.service'; - -@Component({ - template: ` -

Heroes of {{userName}}

- - `, - providers: [ HeroService ] -}) -export class HeroComponent { - userName = ''; - constructor(userService: UserService) { - this.userName = userService.userName; - } -} diff --git a/aio/content/examples/ngmodule-faq/src/app/hero/hero.component.ts b/aio/content/examples/ngmodule-faq/src/app/hero/hero.component.ts deleted file mode 100644 index 86338fb0ae..0000000000 --- a/aio/content/examples/ngmodule-faq/src/app/hero/hero.component.ts +++ /dev/null @@ -1,19 +0,0 @@ -// Exact copy except import UserService from core -import { Component } from '@angular/core'; - -import { HeroService } from './hero.service'; -import { UserService } from '../core/user.service'; - -@Component({ - template: ` -

Heroes of {{userName}}

- - `, - providers: [ HeroService ] -}) -export class HeroComponent { - userName = ''; - constructor(userService: UserService) { - this.userName = userService.userName; - } -} diff --git a/aio/content/examples/ngmodule-faq/src/app/hero/hero.module.3.ts b/aio/content/examples/ngmodule-faq/src/app/hero/hero.module.3.ts deleted file mode 100644 index acd5e28b15..0000000000 --- a/aio/content/examples/ngmodule-faq/src/app/hero/hero.module.3.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { NgModule } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { FormsModule } from '@angular/forms'; - -import { HeroComponent } from './hero.component.3'; -import { HeroDetailComponent } from './hero-detail.component'; -import { HeroListComponent } from './hero-list.component'; -import { HeroRoutingModule } from './hero-routing.module.3'; - -import { HighlightDirective } from './highlight.directive'; - -// #docregion class -@NgModule({ - imports: [ CommonModule, FormsModule, HeroRoutingModule ], - declarations: [ - HeroComponent, HeroDetailComponent, HeroListComponent, - HighlightDirective - ] -}) -export class HeroModule { } -// #enddocregion class diff --git a/aio/content/examples/ngmodule-faq/src/app/hero/hero.module.ts b/aio/content/examples/ngmodule-faq/src/app/hero/hero.module.ts deleted file mode 100644 index 98d7b76b00..0000000000 --- a/aio/content/examples/ngmodule-faq/src/app/hero/hero.module.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { NgModule } from '@angular/core'; - -import { SharedModule } from '../shared/shared.module'; - -import { HeroComponent } from './hero.component'; -import { HeroDetailComponent } from './hero-detail.component'; -import { HeroListComponent } from './hero-list.component'; -import { HeroRoutingModule } from './hero-routing.module'; - -@NgModule({ - imports: [ SharedModule, HeroRoutingModule ], - declarations: [ - HeroComponent, HeroDetailComponent, HeroListComponent, - ] -}) -export class HeroModule { } diff --git a/aio/content/examples/ngmodule-faq/src/app/hero/hero.service.ts b/aio/content/examples/ngmodule-faq/src/app/hero/hero.service.ts deleted file mode 100644 index da3677845f..0000000000 --- a/aio/content/examples/ngmodule-faq/src/app/hero/hero.service.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { Injectable, OnDestroy } from '@angular/core'; - -import { Observable, of } from 'rxjs'; -import { delay } from 'rxjs/operators'; - -export class Hero { - constructor(public id: number, public name: string) { } -} - -const HEROES: Hero[] = [ - new Hero(11, 'Mr. Nice'), - new Hero(12, 'Narco'), - new Hero(13, 'Bombasto'), - new Hero(14, 'Celeritas'), - new Hero(15, 'Magneta'), - new Hero(16, 'RubberMan') -]; - -const FETCH_LATENCY = 500; - -/** Simulate a data service that retrieves heroes from a server */ -@Injectable() -export class HeroService implements OnDestroy { - - constructor() { console.log('HeroService instance created.'); } - ngOnDestroy() { console.log('HeroService instance destroyed.'); } - - getHeroes(): Observable { - return of(HEROES).pipe(delay(FETCH_LATENCY)); - } - - getHero(id: number | string): Observable { - return of(HEROES.find(hero => hero.id === +id)) - .pipe(delay(FETCH_LATENCY)); - } -} diff --git a/aio/content/examples/ngmodule-faq/src/app/shared/awesome.pipe.ts b/aio/content/examples/ngmodule-faq/src/app/shared/awesome.pipe.ts deleted file mode 100644 index a1a0001d24..0000000000 --- a/aio/content/examples/ngmodule-faq/src/app/shared/awesome.pipe.ts +++ /dev/null @@ -1,10 +0,0 @@ -// Exact copy of contact.awesome.pipe -import { Pipe, PipeTransform } from '@angular/core'; - -@Pipe({ name: 'awesome' }) -/** Precede the input string with the word "Awesome " */ -export class AwesomePipe implements PipeTransform { - transform(phrase: string) { - return phrase ? 'Awesome ' + phrase : ''; - } -} diff --git a/aio/content/examples/ngmodule-faq/src/app/shared/highlight.directive.ts b/aio/content/examples/ngmodule-faq/src/app/shared/highlight.directive.ts deleted file mode 100644 index ee874fa536..0000000000 --- a/aio/content/examples/ngmodule-faq/src/app/shared/highlight.directive.ts +++ /dev/null @@ -1,12 +0,0 @@ -// Exact copy of contact/highlight.directive except for color and message -import { Directive, ElementRef } from '@angular/core'; - -@Directive({ selector: '[highlight], input' }) -// Highlight the host element or any InputElement in gray -export class HighlightDirective { - constructor(el: ElementRef) { - el.nativeElement.style.backgroundColor = 'lightgray'; - console.log( - `* Shared highlight called for ${el.nativeElement.tagName}`); - } -} diff --git a/aio/content/examples/ngmodule-faq/src/app/shared/shared.module.ts b/aio/content/examples/ngmodule-faq/src/app/shared/shared.module.ts deleted file mode 100644 index 2da7d7b2a5..0000000000 --- a/aio/content/examples/ngmodule-faq/src/app/shared/shared.module.ts +++ /dev/null @@ -1,18 +0,0 @@ -// #docregion -import { NgModule } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { FormsModule } from '@angular/forms'; - -import { AwesomePipe } from './awesome.pipe'; -import { HighlightDirective } from './highlight.directive'; - -// #docregion module -@NgModule({ - imports: [ CommonModule ], - declarations: [ AwesomePipe, HighlightDirective ], - exports: [ AwesomePipe, HighlightDirective, - CommonModule, FormsModule ] -}) -export class SharedModule { } -// #enddocregion module -// #enddocregion diff --git a/aio/content/examples/ngmodule-faq/src/app/user.service.ts b/aio/content/examples/ngmodule-faq/src/app/user.service.ts deleted file mode 100644 index 7d996b26fa..0000000000 --- a/aio/content/examples/ngmodule-faq/src/app/user.service.ts +++ /dev/null @@ -1,8 +0,0 @@ -// #docregion -import { Injectable } from '@angular/core'; - -@Injectable() -/** Dummy version of an authenticated user service */ -export class UserService { - userName = 'Sherlock Holmes'; -} diff --git a/aio/content/examples/ngmodule-faq/src/index.0.html b/aio/content/examples/ngmodule-faq/src/index.0.html deleted file mode 100644 index 4802670310..0000000000 --- a/aio/content/examples/ngmodule-faq/src/index.0.html +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - NgModule Minimal - - - - - - - - - diff --git a/aio/content/examples/ngmodule-faq/src/index.1.html b/aio/content/examples/ngmodule-faq/src/index.1.html deleted file mode 100644 index 2da2e67b4b..0000000000 --- a/aio/content/examples/ngmodule-faq/src/index.1.html +++ /dev/null @@ -1,13 +0,0 @@ - - - - - NgModule Minimal - - - - - - - - diff --git a/aio/content/examples/ngmodule-faq/src/index.1b.html b/aio/content/examples/ngmodule-faq/src/index.1b.html deleted file mode 100644 index 2da2e67b4b..0000000000 --- a/aio/content/examples/ngmodule-faq/src/index.1b.html +++ /dev/null @@ -1,13 +0,0 @@ - - - - - NgModule Minimal - - - - - - - - diff --git a/aio/content/examples/ngmodule-faq/src/index.2.html b/aio/content/examples/ngmodule-faq/src/index.2.html deleted file mode 100644 index 2da2e67b4b..0000000000 --- a/aio/content/examples/ngmodule-faq/src/index.2.html +++ /dev/null @@ -1,13 +0,0 @@ - - - - - NgModule Minimal - - - - - - - - diff --git a/aio/content/examples/ngmodule-faq/src/index.3.html b/aio/content/examples/ngmodule-faq/src/index.3.html deleted file mode 100644 index 2da2e67b4b..0000000000 --- a/aio/content/examples/ngmodule-faq/src/index.3.html +++ /dev/null @@ -1,13 +0,0 @@ - - - - - NgModule Minimal - - - - - - - - diff --git a/aio/content/examples/ngmodule-faq/src/index.html b/aio/content/examples/ngmodule-faq/src/index.html deleted file mode 100644 index cb62943973..0000000000 --- a/aio/content/examples/ngmodule-faq/src/index.html +++ /dev/null @@ -1,13 +0,0 @@ - - - - - NgModule Deluxe - - - - - - - - diff --git a/aio/content/examples/ngmodule-faq/src/main-static.ts b/aio/content/examples/ngmodule-faq/src/main-static.ts deleted file mode 100644 index a1bcf466d2..0000000000 --- a/aio/content/examples/ngmodule-faq/src/main-static.ts +++ /dev/null @@ -1,13 +0,0 @@ -// #docplaster -/* -// #docregion -// The browser platform without a compiler -import { platformBrowser } from '@angular/platform-browser'; - -// The app module factory produced by the static offline compiler -import { AppModuleNgFactory } from './app/app.module.ngfactory'; - -// Launch with the app module factory. -platformBrowser().bootstrapModuleFactory(AppModuleNgFactory); -// #enddocregion -*/ diff --git a/aio/content/examples/ngmodule-faq/src/main.0.ts b/aio/content/examples/ngmodule-faq/src/main.0.ts deleted file mode 100644 index ed431adb1a..0000000000 --- a/aio/content/examples/ngmodule-faq/src/main.0.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { enableProdMode } from '@angular/core'; -import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; - -import { AppModule } from './app/app.module.0'; -import { environment } from './environments/environment'; - -if (environment.production) { - enableProdMode(); -} - -platformBrowserDynamic().bootstrapModule(AppModule); diff --git a/aio/content/examples/ngmodule-faq/src/main.1.ts b/aio/content/examples/ngmodule-faq/src/main.1.ts deleted file mode 100644 index 1b8a770526..0000000000 --- a/aio/content/examples/ngmodule-faq/src/main.1.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { enableProdMode } from '@angular/core'; -import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; - -import { AppModule } from './app/app.module.1'; -import { environment } from './environments/environment'; - -if (environment.production) { - enableProdMode(); -} - -platformBrowserDynamic().bootstrapModule(AppModule); diff --git a/aio/content/examples/ngmodule-faq/src/main.1b.ts b/aio/content/examples/ngmodule-faq/src/main.1b.ts deleted file mode 100644 index a0095ac64d..0000000000 --- a/aio/content/examples/ngmodule-faq/src/main.1b.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { enableProdMode } from '@angular/core'; -import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; - -import { AppModule } from './app/app.module.1b'; -import { environment } from './environments/environment'; - -if (environment.production) { - enableProdMode(); -} - -platformBrowserDynamic().bootstrapModule(AppModule); diff --git a/aio/content/examples/ngmodule-faq/src/main.2.ts b/aio/content/examples/ngmodule-faq/src/main.2.ts deleted file mode 100644 index 4349ed7403..0000000000 --- a/aio/content/examples/ngmodule-faq/src/main.2.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { enableProdMode } from '@angular/core'; -import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; - -import { AppModule } from './app/app.module.2'; -import { environment } from './environments/environment'; - -if (environment.production) { - enableProdMode(); -} - -platformBrowserDynamic().bootstrapModule(AppModule); diff --git a/aio/content/examples/ngmodule-faq/src/main.3.ts b/aio/content/examples/ngmodule-faq/src/main.3.ts deleted file mode 100644 index 633b21147f..0000000000 --- a/aio/content/examples/ngmodule-faq/src/main.3.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { enableProdMode } from '@angular/core'; -import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; - -import { AppModule } from './app/app.module.3'; -import { environment } from './environments/environment'; - -if (environment.production) { - enableProdMode(); -} - -platformBrowserDynamic().bootstrapModule(AppModule); diff --git a/aio/content/examples/ngmodule-faq/src/main.ts b/aio/content/examples/ngmodule-faq/src/main.ts deleted file mode 100644 index 0740658908..0000000000 --- a/aio/content/examples/ngmodule-faq/src/main.ts +++ /dev/null @@ -1,12 +0,0 @@ -// #docregion -import { enableProdMode } from '@angular/core'; -import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; - -import { AppModule } from './app/app.module'; -import { environment } from './environments/environment'; - -if (environment.production) { - enableProdMode(); -} - -platformBrowserDynamic().bootstrapModule(AppModule); diff --git a/aio/content/examples/ngmodule-faq/stackblitz.json b/aio/content/examples/ngmodule-faq/stackblitz.json deleted file mode 100644 index b56eaeebf8..0000000000 --- a/aio/content/examples/ngmodule-faq/stackblitz.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "description": "NgModule Final", - "files": [ - "src/app/app.component.ts", - "src/app/app.module.ts", - "src/app/app-routing.module.ts", - - "src/app/contact/contact.component.css", - "src/app/contact/contact.component.html", - "src/app/contact/contact.service.ts", - - "src/app/contact/contact.component.ts", - "src/app/contact/contact.module.ts", - "src/app/contact/contact-routing.module.ts", - - "src/app/crisis/*.ts", - - "src/app/hero/hero-detail.component.ts", - "src/app/hero/hero-list.component.ts", - "src/app/hero/hero.service.ts", - - "src/app/hero/hero.component.ts", - "src/app/hero/hero.module.ts", - "src/app/hero/hero-routing.module.ts", - - "src/app/core/*.css", - "src/app/core/*.html", - "src/app/core/*.ts", - - "src/app/shared/*.css", - "src/app/shared/*.html", - "src/app/shared/*.ts", - - "src/main.ts", - "src/styles.css", - "src/index.html" - ], - "main": "src/index.html", - "tags": ["NgModule"] -} diff --git a/aio/content/examples/ngmodules/e2e/src/app.e2e-spec.ts b/aio/content/examples/ngmodules/e2e/src/app.e2e-spec.ts index 42207ea22c..c1d63cf14c 100644 --- a/aio/content/examples/ngmodules/e2e/src/app.e2e-spec.ts +++ b/aio/content/examples/ngmodules/e2e/src/app.e2e-spec.ts @@ -5,8 +5,6 @@ import { browser, element, by } from 'protractor'; describe('NgModule-example', function () { // helpers - const gold = 'rgba(255, 215, 0, 1)'; - const powderblue = 'rgba(176, 224, 230, 1)'; const lightgray = 'rgba(239, 238, 237, 1)'; const white = 'rgba(0, 0, 0, 0)'; @@ -15,7 +13,7 @@ describe('NgModule-example', function () { return { title: element.all(by.tagName('h1')).get(0), - subtitle: element.all(by.css('app-title p i')).get(0), + subtitle: element.all(by.css('app-root p i')).get(0), contactButton: buttons.get(0), itemButton: buttons.get(1), customersButton: buttons.get(2) @@ -67,7 +65,7 @@ describe('NgModule-example', function () { it('should welcome us', function () { const commons = getCommonsSectionStruct(); - expect(commons.subtitle.getText()).toBe('Welcome, ' + (name || 'Sherlock Holmes')); + expect(commons.subtitle.getText()).toBe('Welcome, ' + (name || 'Miss Marple')); }); }; } @@ -76,7 +74,7 @@ describe('NgModule-example', function () { return function() { it('shows the contact\'s owner', function() { const contacts = getContactSectionStruct(); - expect(contacts.header.getText()).toBe('Contact of ' + (name || 'Sherlock Holmes')); + expect(contacts.header.getText()).toBe((name || 'Miss Marple') + '\'s Contacts'); }); it('can cycle between contacts', function () { @@ -92,21 +90,22 @@ describe('NgModule-example', function () { }); }); - it('can change an existing contact', function () { - const contacts = getContactSectionStruct(); - contacts.input.sendKeys('a'); - expect(contacts.input.getCssValue('backgroundColor')).toBe(color); - expect(contacts.contactNameHeader.getText()).toBe('Awesome Yashaa'); - }); - it('can create a new contact', function () { const contacts = getContactSectionStruct(); const newContactButton = contacts.newContactButton; + const nextButton = contacts.nextContactButton; + const input = contacts.input; + const saveButton = contacts.saveButton; + newContactButton.click().then(function () { - expect(contacts.validationError.getText()).toBe('Name is required'); - contacts.input.sendKeys('John Doe'); - expect(contacts.contactNameHeader.getText()).toBe('Awesome John Doe'); - expect(contacts.validationError.getText()).toBe(''); + input.click(); + nextButton.click() + expect(contacts.validationError.getText()).toBe('Name is required.'); + input.click(); + contacts.input.sendKeys('Watson'); + saveButton.click() + expect(contacts.contactNameHeader.getText()).toBe('Awesome Watson'); + }); }); }; diff --git a/aio/content/examples/ngmodules/src/app/app.component.ts b/aio/content/examples/ngmodules/src/app/app.component.ts index 41c28b9ed6..0fda5ec49b 100644 --- a/aio/content/examples/ngmodules/src/app/app.component.ts +++ b/aio/content/examples/ngmodules/src/app/app.component.ts @@ -3,7 +3,7 @@ import { Component } from '@angular/core'; @Component({ selector: 'app-root', template: ` - +