簡體   English   中英

不重定向到子組件 Angular

[英]Not redirecting to child component Angular

我正在創建一個具有以下結構的角度項目

--App
  --Doctor
      --Duty Doctor

我需要從醫生組件移動到值班醫生組件,而醫生組件的標題設計也應該延續到值班醫生組件。 為了做到這一點,我在醫生組件和應用程序模塊中創建了標題代碼,我確實喜歡以下移動方式

 {path: 'doctor', component: DoctorComponent,
  children:[   
    {path: 'dutydoc', component: DutyDoctorComponent}
  ]

該頁面在http://localhost:4200/doctor 中看起來不錯,當重定向到http://localhost4200/doctor/dutydoc 時,該頁面不會加載。

在dutydoctor頁面中,只加載了header組件,沒有加載與dutydoctor頁面相關的代碼。我嘗試在dutydoctor組件中打印控制台登錄,但沒有打印出來。

似乎您也忘記將<router-outlet></router-outlet>到您的標頭組件中

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM