0
私のモジュールの1つ(MasterModule
)から、MasterComponent
とその子ルートをロードします。これらの子のルート怠惰な負荷の一つ私のEquipmentSLModule
:遅延ロードされたモジュールからの直接ルートアクセスを防止する
マスター-routing.module.ts:
機器-SL:このサブモジュールから
const routes: Routes = [
{
path: 'master', redirectTo: '/master/dashboard', pathMatch: 'full'
},
{
path: 'master',
component: MasterComponent,
children: [
{
path: 'dashboard',
component: DashboardComponent,
},
... // Other routes
{
path: 'SL',
loadChildren: './../equipment/equipment-SL.module#EquipmentSLModule'
}
]
}
];
は、私が子供のルートを追加しますルーティングモジュール.ts
const routes: Routes = [
{
path: 'toto',
component: EquipmentComponent,
},
];
次に私のルートにアクセスできますが成功しましたが、URLから/toto
に直接行くこともできます。 /toto
へのアクセスを禁止する方法はありますか?
Iは遅延負荷から 'マスタ/ SL/toto'経路を必要とするので、それは'機器-SL-routing.module.ts'からルーティングを定義しているように私は、それを削除することはできません。 'CanActivate'以外のオプションはありませんか? –
@AlexBeugnetアップデート –
を参照してください。問題を変更しないで、 '/ master/SL '(私が望むもの)に到達することができますが、手動で'' ''に行くこともできます。 is not good –