Петров Андрей
const routes: Routes = [{
path: '',
pathMatch: 'full',
component: BoardComponent,
}, {
path: 'tasks/:id',
component: TaskPageComponent
}];
@NgModule({
declarations: [AppComponent, BoardComponent, TaskPageComponent],
imports: [CommonModule, RouterModule.forRoot(routes)],
bootstrap: [AppComponent],
})
export class AppModule {
}
<p> Это Канбан! </p>
<router-outlet></router-outlet>
<a routerLink="/user/bob"
routerLinkActive="class1 class2">
Bob
</a>
<a [routerLink]="['user', 'bob']"
[routerLinkActive]="['class1', 'class2']">
Bob
</a>
const routes: Routes = [{
path: '',
pathMatch: 'full',
component: BoardComponent,
}, {
path: 'tasks/:id',
component: TaskPageComponent
}];
constructor(private route: ActivatedRoute, private backend: BackendService) {
}
ngOnInit() {
this.taskSub = this.route.params
.pipe(
map(params => parseInt(params.id, 10)),
switchMap(id => this.backend.getTask(id))
)
.subscribe(task => this.task = task);
}