簡體   English   中英

如何為 nb-route-tabset/ngx-admin 設置 activeLinkOptions

[英]how to set activeLinkOptions for nb-route-tabset/ngx-admin

我希望為多個鏈接突出顯示選項卡。 我不確定我是否誤解了功能。 以下是我的代碼。

<div class="row">
  <div class="col-12">
    <nb-card size="small">
      <nb-route-tabset [tabs]="tabs" fullWidth activeLinkOptions="{exact:
    false}"></nb-route-tabset>
    </nb-card>
 </div>
</div>

我的組件:

  tabs: any[] = [
  {
    title: 'Contacts',
    route: '/addressbook/contact',
    icon: 'person-outline',
    responsive: true, 
  },
  {
    title: 'Companies',
    route: '/addressbook/company',
    icon: 'people-outline',
    responsive: true, 

  },
  {
    title: 'Company Types',
    route: '/addressbook/companytype/index',
    icon: 'grid-outline',
    responsive: true, 
  },
];

渲染的 html:

<li _ngcontent-eap-c56="" class="route-tab responsive ng-star-inserted" routerlinkactive="active" tabindex="0" ng-reflect-router-link="/addressbook/companytype/index" ng-reflect-router-link-active-options="{exact:
    false}" ng-reflect-router-link-active="active">

我希望每當我訪問“/addressbook/companytype/create”時,“公司類型”選項卡都會突出顯示。 這是“exact:false”的預期行為嗎?

任何幫助將不勝感激!

Jason 上面在 stackblitz 上嘗試的評論幫助我理解了 activeLinkOptions 的用法。 我的兩個網址如下。

"/addressbook/companytype/Index" - 父級 "/addressbook/companytype/create" - 子級

如您所見,孩子不是從父母那里繼承的。 所以它沒有用。 現在將 URL 更改為如下所示,效果很好。

"/addressbook/companytype" - 父級 "/addressbook/companytype/create" - 子級

暫無
暫無

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

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