1

I want to add that whenRoute optional parameter to data inside the Route type, how do I do it without modifying angular types file directly ?

const routes: Routes = [
  {
    path: 'pages',
    loadChildren: () => import('./pages/pages.module').then(m => m.PagesModule),
    data: { whenRoute: '/test'}
  }
]
Mauro Insacco
  • 1,136
  • 4
  • 10
  • 25

1 Answers1

0

You shouldn't need to modify any types. the data property is of type Data which has the following declaration:

export declare type Data = {
    [name: string]: any;
};

In other words you can put any named property in your data object, and those properties can have any values.

Fredrik_Borgstrom
  • 2,504
  • 25
  • 32