docs(router): chalin router copyedits #3054 (#3060)

* docs(router): chalin copyedits
* docs(router): bell copy edits + routing module order & inspect config
This commit is contained in:
Ward Bell 2017-01-01 00:25:52 -08:00 committed by GitHub
parent 7c9ff12a76
commit ce174a26fb
12 changed files with 432 additions and 349 deletions

View File

@ -1,14 +1,14 @@
// #docplaster
// #docregion
// #docregion v2
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { CrisisListComponent } from './crisis-list.component';
// import { HeroListComponent } from './hero-list.component'; // <-- delete this line
import { PageNotFoundComponent } from './not-found.component';
const appRoutes: Routes = [
{ path: 'crisis-center', component: CrisisListComponent },
// { path: 'heroes', component: HeroListComponent }, // <-- delete this line
{ path: '', redirectTo: '/heroes', pathMatch: 'full' },
{ path: '**', component: PageNotFoundComponent }
];

View File

@ -8,7 +8,7 @@ import { PageNotFoundComponent } from './not-found.component';
import { CanDeactivateGuard } from './can-deactivate-guard.service';
import { AuthGuard } from './auth-guard.service';
import { SelectivePreloadingStrategy } from './selective-preloading-strategy';
import { SelectivePreloadingStrategy } from './selective-preloading-strategy';
const appRoutes: Routes = [
{
@ -47,4 +47,4 @@ const appRoutes: Routes = [
SelectivePreloadingStrategy
]
})
export class AppRoutingModule {}
export class AppRoutingModule { }

View File

@ -9,9 +9,9 @@ import { Component } from '@angular/core';
<nav>
<a routerLink="/crisis-center" routerLinkActive="active">Crisis Center</a>
<a routerLink="/heroes" routerLinkActive="active">Heroes</a>
// #docregion contact-link
<a [routerLink]="[{ outlets: { popup: ['compose'] } }]">Contact</a>
// #enddocregion contact-link
// #docregion contact-link
<a [routerLink]="[{ outlets: { popup: ['compose'] } }]">Contact</a>
// #enddocregion contact-link
</nav>
// #docregion outlets
<router-outlet></router-outlet>

View File

@ -11,12 +11,14 @@ import { CrisisListComponent } from './crisis-list.component';
import { PageNotFoundComponent } from './not-found.component';
@NgModule({
// #docregion module-imports
imports: [
BrowserModule,
FormsModule,
HeroesModule,
AppRoutingModule
],
// #enddocregion module-imports
declarations: [
AppComponent,
CrisisListComponent,

View File

@ -1,8 +1,12 @@
// #docplaster
// #docregion
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { FormsModule } from '@angular/forms';
// #docregion inspect-config
import { Router } from '@angular/router';
// #enddocregion inspect-config
import { AppComponent } from './app.component';
import { AppRoutingModule } from './app-routing.module';
@ -33,4 +37,11 @@ import { DialogService } from './dialog.service';
],
bootstrap: [ AppComponent ]
})
export class AppModule { }
// #docregion inspect-config
export class AppModule {
// Diagnostic only: inspect router configuration
constructor(router: Router) {
console.log('Routes: ', JSON.stringify(router.config, undefined, 2));
}
}
// #enddocregion inspect-config

View File

@ -1,5 +1,5 @@
// #docplaster
// #docregion
// #docregion , mock-crises
export class Crisis {
constructor(public id: number, public name: string) { }
}
@ -10,6 +10,7 @@ const CRISES = [
new Crisis(3, 'Giant Asteroid Heading For Earth'),
new Crisis(4, 'Procrastinators Meeting Delayed Again'),
];
// #enddocregion mock-crises
let crisesPromise = Promise.resolve(CRISES);
@ -28,8 +29,7 @@ export class CrisisService {
.then(crises => crises.find(crisis => crisis.id === +id));
}
// #enddocregion
// #enddocregion
addCrisis(name: string) {
name = name.trim();
if (name) {
@ -37,6 +37,5 @@ export class CrisisService {
crisesPromise.then(crises => crises.push(crisis));
}
}
// #docregion
// #docregion
}
// #enddocregion

View File

@ -1,25 +0,0 @@
// #docregion
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { HeroListComponent } from './hero-list.component';
import { HeroDetailComponent } from './hero-detail.component';
import { HeroService } from './hero.service';
@NgModule({
imports: [
CommonModule,
FormsModule
],
declarations: [
HeroListComponent,
HeroDetailComponent
],
providers: [
HeroService
]
})
export class HeroesModule {}
// #enddocregion

View File

@ -1,4 +1,6 @@
// #docplaster
// #docregion
// #docregion v1
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
@ -8,23 +10,24 @@ import { HeroDetailComponent } from './hero-detail.component';
import { HeroService } from './hero.service';
// #docregion heroes-routes
// #enddocregion v1
import { HeroRoutingModule } from './heroes-routing.module';
// #docregion v1
@NgModule({
imports: [
CommonModule,
FormsModule,
// #enddocregion v1
HeroRoutingModule
// #docregion v1
],
declarations: [
HeroListComponent,
HeroDetailComponent
],
providers: [
HeroService
]
providers: [ HeroService ]
})
// #enddocregion heroes-routes
export class HeroesModule {}
// #enddocregion v1
// #enddocregion

View File

@ -6,7 +6,7 @@
<!-- #docregion base-href -->
<base href="/">
<!-- #enddocregion base-href -->
<title>Router Sample</title>
<title>Angular Router</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="styles.css">

View File

@ -3,7 +3,7 @@
"files":[
"!**/*.d.ts",
"!**/*.js",
"!**/*.[1].*"
"!**/*.[1,2].*"
],
"tags": ["tutorial", "tour", "heroes"]
}

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB