angular 9 change menu link item at runtime

Solutions on MaxInterview for angular 9 change menu link item at runtime by the best coders in the world

showing results for - "angular 9 change menu link item at runtime"
Benjamin
23 Feb 2020
1import { Component } from '@angular/core';
2import { NbMenuService, NbMenuItem } from '@nebular/theme';
3
4@Component({
5  selector: 'app-pages',
6  template: `
7            <app-layout>
8              <nb-menu [items]="menu"></nb-menu>
9              <router-outlet></router-outlet>
10            </app-layout>
11            `,
12})
13export class PagesComponent {
14  menu = [];
15  newMenuItem: NbMenuItem[] = [
16  {
17    title: 'Home',
18    icon: 'ion-home',
19    link: 'app/home',
20    home: true,
21  }]
22  constructor( private nbMenuService: NbMenuService ) {
23    this.nbMenuService.addItems(this.newMenuItem);
24  }
25}
26