* docs(router): chalin copyedits * docs(router): bell copy edits + routing module order & inspect config
This commit is contained in:
parent
7c9ff12a76
commit
ce174a26fb
|
@ -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 }
|
||||
];
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
@ -29,7 +30,6 @@ export class CrisisService {
|
|||
}
|
||||
|
||||
// #enddocregion
|
||||
|
||||
addCrisis(name: string) {
|
||||
name = name.trim();
|
||||
if (name) {
|
||||
|
@ -39,4 +39,3 @@ export class CrisisService {
|
|||
}
|
||||
// #docregion
|
||||
}
|
||||
// #enddocregion
|
||||
|
|
|
@ -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
|
|
@ -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
|
||||
|
|
|
@ -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">
|
||||
|
|
|
@ -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 |
Loading…
Reference in New Issue