I have some lazy loaded routes as following:
const routes: Routes = [
{
path: ':lang',
loadChildren: './components/home/home.module#HomeModule',
// redirectTo: "en"
},
{
path: ':id/customers',
loadChildren: './components/customers/customers.module#CustomersModule'
},
{
path: 'products',
loadChildren: './components/products/products.module#ProductsModule'
}
];
When I open the page with this url: http://localhost:4200/en it works fine. But the user doesn't know to add en parameter to the url, so the page doesn't load without parameter. So, I must redirect it to /en. But when I use redirectTo: "en" I get the following errors:
Error: Invalid configuration of route ':lang': redirectTo and loadChildren cannot be used together
I found something about this error, but doesn't relate to my case. Any idea?