closes #1905 Added section for RouterLinkActive Added section for global query params and fragments Added section for RouterState Added wildcard route to example configuration Updated code samples Renamed .guard files to .service Renamed interfaces.ts to can-deactivate-guard.service.ts Removed unused files
30 lines
847 B
TypeScript
30 lines
847 B
TypeScript
// #docregion
|
|
import { Component } from '@angular/core';
|
|
import { ROUTER_DIRECTIVES } from '@angular/router';
|
|
|
|
import { DialogService } from './dialog.service';
|
|
import { HeroService } from './heroes/hero.service';
|
|
|
|
@Component({
|
|
selector: 'my-app',
|
|
// #docregion template
|
|
template: `
|
|
<h1 class="title">Component Router</h1>
|
|
<nav>
|
|
<a routerLink="/crisis-center" routerLinkActive="active"
|
|
[routerLinkActiveOptions]="{ exact: true }">Crisis Center</a>
|
|
<a routerLink="/heroes" routerLinkActive="active">Heroes</a>
|
|
<a routerLink="/crisis-center/admin" routerLinkActive="active">Crisis Admin</a>
|
|
</nav>
|
|
<router-outlet></router-outlet>
|
|
`,
|
|
// #enddocregion template
|
|
providers: [
|
|
HeroService,
|
|
DialogService
|
|
],
|
|
directives: [ROUTER_DIRECTIVES]
|
|
})
|
|
export class AppComponent {
|
|
}
|