Skip to content
This repository was archived by the owner on Dec 4, 2017. It is now read-only.

Commit ce174a2

Browse files
authored
docs(router): chalin router copyedits #3054 (#3060)
* docs(router): chalin copyedits * docs(router): bell copy edits + routing module order & inspect config
1 parent 7c9ff12 commit ce174a2

File tree

12 files changed

+428
-345
lines changed

12 files changed

+428
-345
lines changed

public/docs/_examples/router/ts/app/app-routing.module.2.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
// #docplaster
21
// #docregion
3-
// #docregion v2
42
import { NgModule } from '@angular/core';
53
import { RouterModule, Routes } from '@angular/router';
64

75
import { CrisisListComponent } from './crisis-list.component';
6+
// import { HeroListComponent } from './hero-list.component'; // <-- delete this line
87
import { PageNotFoundComponent } from './not-found.component';
98

109
const appRoutes: Routes = [
1110
{ path: 'crisis-center', component: CrisisListComponent },
11+
// { path: 'heroes', component: HeroListComponent }, // <-- delete this line
1212
{ path: '', redirectTo: '/heroes', pathMatch: 'full' },
1313
{ path: '**', component: PageNotFoundComponent }
1414
];

public/docs/_examples/router/ts/app/app-routing.module.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { PageNotFoundComponent } from './not-found.component';
88

99
import { CanDeactivateGuard } from './can-deactivate-guard.service';
1010
import { AuthGuard } from './auth-guard.service';
11-
import { SelectivePreloadingStrategy } from './selective-preloading-strategy';
11+
import { SelectivePreloadingStrategy } from './selective-preloading-strategy';
1212

1313
const appRoutes: Routes = [
1414
{
@@ -47,4 +47,4 @@ const appRoutes: Routes = [
4747
SelectivePreloadingStrategy
4848
]
4949
})
50-
export class AppRoutingModule {}
50+
export class AppRoutingModule { }

public/docs/_examples/router/ts/app/app.component.4.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ import { Component } from '@angular/core';
99
<nav>
1010
<a routerLink="/crisis-center" routerLinkActive="active">Crisis Center</a>
1111
<a routerLink="/heroes" routerLinkActive="active">Heroes</a>
12-
// #docregion contact-link
13-
<a [routerLink]="[{ outlets: { popup: ['compose'] } }]">Contact</a>
14-
// #enddocregion contact-link
12+
// #docregion contact-link
13+
<a [routerLink]="[{ outlets: { popup: ['compose'] } }]">Contact</a>
14+
// #enddocregion contact-link
1515
</nav>
1616
// #docregion outlets
1717
<router-outlet></router-outlet>

public/docs/_examples/router/ts/app/app.module.3.ts

+2
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,14 @@ import { CrisisListComponent } from './crisis-list.component';
1111
import { PageNotFoundComponent } from './not-found.component';
1212

1313
@NgModule({
14+
// #docregion module-imports
1415
imports: [
1516
BrowserModule,
1617
FormsModule,
1718
HeroesModule,
1819
AppRoutingModule
1920
],
21+
// #enddocregion module-imports
2022
declarations: [
2123
AppComponent,
2224
CrisisListComponent,

public/docs/_examples/router/ts/app/app.module.ts

+12-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1+
// #docplaster
12
// #docregion
23
import { NgModule } from '@angular/core';
34
import { BrowserModule } from '@angular/platform-browser';
45
import { FormsModule } from '@angular/forms';
6+
// #docregion inspect-config
7+
import { Router } from '@angular/router';
58

9+
// #enddocregion inspect-config
610
import { AppComponent } from './app.component';
711
import { AppRoutingModule } from './app-routing.module';
812

@@ -33,4 +37,11 @@ import { DialogService } from './dialog.service';
3337
],
3438
bootstrap: [ AppComponent ]
3539
})
36-
export class AppModule { }
40+
// #docregion inspect-config
41+
export class AppModule {
42+
// Diagnostic only: inspect router configuration
43+
constructor(router: Router) {
44+
console.log('Routes: ', JSON.stringify(router.config, undefined, 2));
45+
}
46+
}
47+
// #enddocregion inspect-config

public/docs/_examples/router/ts/app/crisis-center/crisis.service.ts

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// #docplaster
2-
// #docregion
2+
// #docregion , mock-crises
33
export class Crisis {
44
constructor(public id: number, public name: string) { }
55
}
@@ -10,6 +10,7 @@ const CRISES = [
1010
new Crisis(3, 'Giant Asteroid Heading For Earth'),
1111
new Crisis(4, 'Procrastinators Meeting Delayed Again'),
1212
];
13+
// #enddocregion mock-crises
1314

1415
let crisesPromise = Promise.resolve(CRISES);
1516

@@ -28,15 +29,13 @@ export class CrisisService {
2829
.then(crises => crises.find(crisis => crisis.id === +id));
2930
}
3031

31-
// #enddocregion
32-
32+
// #enddocregion
3333
addCrisis(name: string) {
3434
name = name.trim();
3535
if (name) {
3636
let crisis = new Crisis(CrisisService.nextCrisisId++, name);
3737
crisesPromise.then(crises => crises.push(crisis));
3838
}
3939
}
40-
// #docregion
40+
// #docregion
4141
}
42-
// #enddocregion

public/docs/_examples/router/ts/app/heroes/heroes.module.1.ts

-25
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
// #docplaster
12
// #docregion
3+
// #docregion v1
24
import { NgModule } from '@angular/core';
35
import { CommonModule } from '@angular/common';
46
import { FormsModule } from '@angular/forms';
@@ -8,23 +10,24 @@ import { HeroDetailComponent } from './hero-detail.component';
810

911
import { HeroService } from './hero.service';
1012

11-
// #docregion heroes-routes
13+
// #enddocregion v1
1214
import { HeroRoutingModule } from './heroes-routing.module';
1315

16+
// #docregion v1
1417
@NgModule({
1518
imports: [
1619
CommonModule,
1720
FormsModule,
21+
// #enddocregion v1
1822
HeroRoutingModule
23+
// #docregion v1
1924
],
2025
declarations: [
2126
HeroListComponent,
2227
HeroDetailComponent
2328
],
24-
providers: [
25-
HeroService
26-
]
29+
providers: [ HeroService ]
2730
})
28-
// #enddocregion heroes-routes
2931
export class HeroesModule {}
32+
// #enddocregion v1
3033
// #enddocregion

public/docs/_examples/router/ts/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<!-- #docregion base-href -->
77
<base href="/">
88
<!-- #enddocregion base-href -->
9-
<title>Router Sample</title>
9+
<title>Angular Router</title>
1010
<meta charset="UTF-8">
1111
<meta name="viewport" content="width=device-width, initial-scale=1">
1212
<link rel="stylesheet" href="styles.css">

public/docs/_examples/toh-4/ts/plnkr.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"files":[
44
"!**/*.d.ts",
55
"!**/*.js",
6-
"!**/*.[1].*"
6+
"!**/*.[1,2].*"
77
],
88
"tags": ["tutorial", "tour", "heroes"]
99
}

0 commit comments

Comments
 (0)