[英]Angular App with Bootstrap Dynamic Tabs Navigation
我正在嘗試使用 Angular 和 Bootstrap 創建一個 SPA。 我有一個帶鏈接的菜單。 當用戶單擊鏈接時,新的 Bootstrap 動態選項卡將打開,其內容為 . 現在,我想在選項卡內添加一些導航。 例如:
我有一個銷售注冊組件。 在它里面,我有四個指向其他組件的鏈接。 我想在相同的引導程序選項卡的內容中打開鏈接位置(例如 routerLink='path_to_component')。
任何解決方案如何實現它?
我認為您想為此使用多個路由器插座。
您需要將一個命名的路由器插座添加到您的銷售注冊組件中,例如:
<router-outlet name='outletname'></router-outlet>
然后,您還需要定義要在 Routes 數組中加載的組件,例如:
const routes: Routes = [
{ path: "page", component: PageComponent }, // This is your primary outlet's definition
{
path: "tabpage",
component: TabPageComponent,
outlet: "outletname" // This is where you define which outlet to use
}
]
最后更新導航鏈接以使用您的插座:
<a [routerLink]="[{ outlets: { primary: ['page'], outletname: ['tabpage'] } }]">
Link to the tab
</a>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.