Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add a param to the route tabset components in ngx-admin nebular and angular 5

i need to add a param to the route tabset component in ngx-admin nebular and angular 5 as follow:

tabs: any[] = [
    {
      title: 'My tab 1',
      route: '/pages/projects/edit/tab1/:id',
    }...
]

Is there a way to do it?

Thanks in advance

like image 273
Jesús Ibáñez Avatar asked Feb 15 '18 01:02

Jesús Ibáñez


1 Answers

Here is the solution I am currently using.

TS

tabs: any[];

async ngOnInit() {
  const id = await getIdLogic();
  this.tabs = [
    {
      title: 'Tab 1',
      route: `.../.../${id}`
    },
    ...
   ]
}

And then in you HTML you need to remember to only render the nb-route-tabset component once the tabs have been set.

HTML

 <nb-route-tabset *ngIf="tabs" [tabs]="tabs"></nb-route-tabset>
like image 133
Matthew Mullin Avatar answered Sep 24 '22 09:09

Matthew Mullin