Object literal may only specify known properties, and 'text' does not exist in type 'Route'.

src/app/app-routing.module.ts
const routes: Routes = [
{ path: '', redirectTo: '/dashboard', pathMatch: 'full' },
{ path: 'detail/:id', component: HeroDetailComponent },
{ path: "dashboard", component: DashboardComponent, text: "Dashboard" },
{ path: "heroes", component: HeroesComponent, text: "Heroes" },
];

This happened when I ran the update command to get onto Angular v15: ng update @angular/core@15 @angular/cli@15.
I fixed it after seeing this in the breaking changes: https://angular.io/guide/update-to-version-15#the-title-property-is-required-on-activatedroutesnapshot
Changing text to title seemed to get rid of the error.
src/app/app-routing.module.ts [old]
const routes: Routes = [
{ path: '', redirectTo: '/dashboard', pathMatch: 'full' },
{ path: 'detail/:id', component: HeroDetailComponent },
{ path: "dashboard", component: DashboardComponent, text: "Dashboard" },
{ path: "heroes", component: HeroesComponent, text: "Heroes" },
];
src/app/app-routing.module.ts [new]
const routes: Routes = [
{ path: '', redirectTo: '/dashboard', pathMatch: 'full' },
{ path: 'detail/:id', component: HeroDetailComponent },
{ path: "dashboard", component: DashboardComponent, title: "Dashboard" },
{ path: "heroes", component: HeroesComponent, title: "Heroes" },
];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With