angular 9 change menu link item at runtime
import { Component } from '@angular/core';
import { NbMenuService, NbMenuItem } from '@nebular/theme';
@Component({
selector: 'app-pages',
template: `
<app-layout>
<nb-menu [items]="menu"></nb-menu>
<router-outlet></router-outlet>
</app-layout>
`,
})
export class PagesComponent {
menu = [];
newMenuItem: NbMenuItem[] = [
{
title: 'Home',
icon: 'ion-home',
link: 'app/home',
home: true,
}]
constructor( private nbMenuService: NbMenuService ) {
this.nbMenuService.addItems(this.newMenuItem);
}
}