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: '
- 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: ` -