I have routes config
const appRoutes: Routes = [
{ path: '', loadChildren: 'app/+home/home.module#HomeModule' },
{ path: 'auth', loadChildren: 'app/+auth/auth.module#AuthModule' },
{ path: ':category', loadChildren: 'app/+search/search.module#SearchModule' },
{
path: '**',
component: PageNotFoundComponent,
data: { title: 'Page not found' }
},
];
I need to check if :category
route param value exist as a search category in database, if so activate route, else go to 404 page (in this case PageNotFoundComponent).
Using CanActivate is the best way? How about navigating to 404 page?