**base path is - **
when I click to load another page by clicking to menue my route becomes
and I get error
ERROR Error: Uncaught (in promise): Error: Cannot match any routes. URL Segment: 'matchcenter/cricket/football' Error: Cannot match any routes. URL Segment: 'matchcenter/cricket/football'
html
<mat-tab *ngFor="let item of navLinks" >
<div routerLink="{{item.path}}">{{item.label}}</div>
</mat-tab>
ts file
import { Component, OnInit } from '@angular/core';
import { CricketComponent } from '../cricket/cricket.component';
@Component({
selector: 'app-header',
templateUrl: './header.component.html',
styleUrls: ['./header.component.scss']
})
export class HeaderComponent implements OnInit {
navLinks:any;
constructor() {
this.navLinks=[
{path:'cricket',label: 'Cricket'},
{path:'football',label: 'Football'},
{path:'nba',label: 'NBA'},
]
}
ngOnInit() {
}
}
app-routing.module.ts
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { LoginComponent } from './login/login.component';
import { RegisterComponent } from './register/register.component';
import { ErrorComponent } from './error/error.component';
import { MatchcenterComponent } from './matchcenter/matchcenter.component';
import { FleshScreenComponent } from './flesh-screen/flesh-screen.component';
import { CricketComponent } from './cricket/cricket.component'
const routes: Routes = [
{path: '' , component: FleshScreenComponent, pathMatch:'full' },
{ path: 'login' , component:LoginComponent },
{ path: 'register' , component: RegisterComponent },
{ path: 'error' , component: ErrorComponent},
{ path: 'matchcenter' , component: MatchcenterComponent},
{ path: 'matchcenter/cricket' , component: CricketComponent},
];
@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule]
})
export class AppRoutingModule { }