の経路のparamを解決するためにはどうすればルートの設定を持っているは角2
私は:category
ルートのparam値は、データベース内の検索カテゴリとして存在している場合ので、それ以外は(404ページに移動し、ルート活性化させる場合は、チェックする必要があり
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' }
},
];
この場合はPageNotFoundComponent)。
CanActivateを使用するのが最適ですか? 404ページへの移動はどうですか?
あなたはおそらく、https://angular.io/docs/ts/latest/guide/router.html#!#guards –