* 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
|
||||||
// #docregion v2
|
|
||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
import { RouterModule, Routes } from '@angular/router';
|
import { RouterModule, Routes } from '@angular/router';
|
||||||
|
|
||||||
import { CrisisListComponent } from './crisis-list.component';
|
import { CrisisListComponent } from './crisis-list.component';
|
||||||
|
// import { HeroListComponent } from './hero-list.component'; // <-- delete this line
|
||||||
import { PageNotFoundComponent } from './not-found.component';
|
import { PageNotFoundComponent } from './not-found.component';
|
||||||
|
|
||||||
const appRoutes: Routes = [
|
const appRoutes: Routes = [
|
||||||
{ path: 'crisis-center', component: CrisisListComponent },
|
{ path: 'crisis-center', component: CrisisListComponent },
|
||||||
|
// { path: 'heroes', component: HeroListComponent }, // <-- delete this line
|
||||||
{ path: '', redirectTo: '/heroes', pathMatch: 'full' },
|
{ path: '', redirectTo: '/heroes', pathMatch: 'full' },
|
||||||
{ path: '**', component: PageNotFoundComponent }
|
{ path: '**', component: PageNotFoundComponent }
|
||||||
];
|
];
|
||||||
|
|
|
@ -11,12 +11,14 @@ import { CrisisListComponent } from './crisis-list.component';
|
||||||
import { PageNotFoundComponent } from './not-found.component';
|
import { PageNotFoundComponent } from './not-found.component';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
|
// #docregion module-imports
|
||||||
imports: [
|
imports: [
|
||||||
BrowserModule,
|
BrowserModule,
|
||||||
FormsModule,
|
FormsModule,
|
||||||
HeroesModule,
|
HeroesModule,
|
||||||
AppRoutingModule
|
AppRoutingModule
|
||||||
],
|
],
|
||||||
|
// #enddocregion module-imports
|
||||||
declarations: [
|
declarations: [
|
||||||
AppComponent,
|
AppComponent,
|
||||||
CrisisListComponent,
|
CrisisListComponent,
|
||||||
|
|
|
@ -1,8 +1,12 @@
|
||||||
|
// #docplaster
|
||||||
// #docregion
|
// #docregion
|
||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
import { BrowserModule } from '@angular/platform-browser';
|
import { BrowserModule } from '@angular/platform-browser';
|
||||||
import { FormsModule } from '@angular/forms';
|
import { FormsModule } from '@angular/forms';
|
||||||
|
// #docregion inspect-config
|
||||||
|
import { Router } from '@angular/router';
|
||||||
|
|
||||||
|
// #enddocregion inspect-config
|
||||||
import { AppComponent } from './app.component';
|
import { AppComponent } from './app.component';
|
||||||
import { AppRoutingModule } from './app-routing.module';
|
import { AppRoutingModule } from './app-routing.module';
|
||||||
|
|
||||||
|
@ -33,4 +37,11 @@ import { DialogService } from './dialog.service';
|
||||||
],
|
],
|
||||||
bootstrap: [ AppComponent ]
|
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
|
// #docplaster
|
||||||
// #docregion
|
// #docregion , mock-crises
|
||||||
export class Crisis {
|
export class Crisis {
|
||||||
constructor(public id: number, public name: string) { }
|
constructor(public id: number, public name: string) { }
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@ const CRISES = [
|
||||||
new Crisis(3, 'Giant Asteroid Heading For Earth'),
|
new Crisis(3, 'Giant Asteroid Heading For Earth'),
|
||||||
new Crisis(4, 'Procrastinators Meeting Delayed Again'),
|
new Crisis(4, 'Procrastinators Meeting Delayed Again'),
|
||||||
];
|
];
|
||||||
|
// #enddocregion mock-crises
|
||||||
|
|
||||||
let crisesPromise = Promise.resolve(CRISES);
|
let crisesPromise = Promise.resolve(CRISES);
|
||||||
|
|
||||||
|
@ -29,7 +30,6 @@ export class CrisisService {
|
||||||
}
|
}
|
||||||
|
|
||||||
// #enddocregion
|
// #enddocregion
|
||||||
|
|
||||||
addCrisis(name: string) {
|
addCrisis(name: string) {
|
||||||
name = name.trim();
|
name = name.trim();
|
||||||
if (name) {
|
if (name) {
|
||||||
|
@ -39,4 +39,3 @@ export class CrisisService {
|
||||||
}
|
}
|
||||||
// #docregion
|
// #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
|
||||||
|
// #docregion v1
|
||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { FormsModule } from '@angular/forms';
|
import { FormsModule } from '@angular/forms';
|
||||||
|
@ -8,23 +10,24 @@ import { HeroDetailComponent } from './hero-detail.component';
|
||||||
|
|
||||||
import { HeroService } from './hero.service';
|
import { HeroService } from './hero.service';
|
||||||
|
|
||||||
// #docregion heroes-routes
|
// #enddocregion v1
|
||||||
import { HeroRoutingModule } from './heroes-routing.module';
|
import { HeroRoutingModule } from './heroes-routing.module';
|
||||||
|
|
||||||
|
// #docregion v1
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
CommonModule,
|
CommonModule,
|
||||||
FormsModule,
|
FormsModule,
|
||||||
|
// #enddocregion v1
|
||||||
HeroRoutingModule
|
HeroRoutingModule
|
||||||
|
// #docregion v1
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
HeroListComponent,
|
HeroListComponent,
|
||||||
HeroDetailComponent
|
HeroDetailComponent
|
||||||
],
|
],
|
||||||
providers: [
|
providers: [ HeroService ]
|
||||||
HeroService
|
|
||||||
]
|
|
||||||
})
|
})
|
||||||
// #enddocregion heroes-routes
|
|
||||||
export class HeroesModule {}
|
export class HeroesModule {}
|
||||||
|
// #enddocregion v1
|
||||||
// #enddocregion
|
// #enddocregion
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<!-- #docregion base-href -->
|
<!-- #docregion base-href -->
|
||||||
<base href="/">
|
<base href="/">
|
||||||
<!-- #enddocregion base-href -->
|
<!-- #enddocregion base-href -->
|
||||||
<title>Router Sample</title>
|
<title>Angular Router</title>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<link rel="stylesheet" href="styles.css">
|
<link rel="stylesheet" href="styles.css">
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
"files":[
|
"files":[
|
||||||
"!**/*.d.ts",
|
"!**/*.d.ts",
|
||||||
"!**/*.js",
|
"!**/*.js",
|
||||||
"!**/*.[1].*"
|
"!**/*.[1,2].*"
|
||||||
],
|
],
|
||||||
"tags": ["tutorial", "tour", "heroes"]
|
"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