我在我的 Angular 前端应用程序中使用 nebular,并且想要设置选中的活动链接。我怎样才能实现它?
我已经尝试使用 menuItem 的 selected 属性,但它仅应用于项目对象并且没有 [routerLinkActive] 选项
@Component({
selector: 'nebular-pages',
styleUrls: ['nebular.component.scss'],
template: `
<ngx-sample-layout>
<nb-menu [items]="menu"></nb-menu>
<router-outlet></router-outlet>
</ngx-sample-layout>
`,
})
export class NebularComponent {
menu: NbMenuItem[];
constructor() { }
this.menu = [
{
title: 'Page1',
link: `/user/params`,
icon: 'nb-grid-b-outline',
home: true,
},
{
title: 'Page2',
link: '/user/options',
icon: 'nb-arrow-thin-right',
},
{
title: 'Page3',
icon: 'nb-list',
children:[
{
title: 'Costs',
link: '/user/costs',
icon: 'nb-arrow-thin-right',
},
{
title: "Benifits",
link: "/user/benifits",
icon: "nb-compose"
},
]
},
];