Currently in my project, I am using Angular 4.1 with side menu feature. Right side I have hamburger menu icon. On click of it, I want to show labels with icons.
Below is my code
- burger-menu.template.html
<div class="burger-menu-container"> <p-menu [model]="items"></p-menu> </div>
- burger-menu.component.ts
import { MenuItem } from 'primeng/primeng';
Inside the class I have declared my variable like:
public items: MenuItem[];
In ngOnInit I called below method:
this.menuItem();
Function Implementation:
private menuItem(): void {
this.items = [
{
label: this.translate.instant('burgermainmenu.mycompanyrestaurantlabel'), icon: 'home-icon', command: (event) => {
this.arrowClick('home');
}
},
{
label: this.translate.instant('burgermainmenu.allcompanyrestaurantlabel'), icon: 'all-cafeteria-icon',
routerLink: ['../../cafe/cafeteria-list', 'list-view', { id: this.currentLocation }],
command: (event) => {
this.arrowClick('');
}
}]
- app.module.ts
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
Inside @NgModule below things are already imported
imports: [
BrowserModule,
HttpClientModule,
RouterModule.forRoot(ROUTES, { useHash: true }),
BrowserAnimationsModule,
SharedModule,
TranslateModule.forRoot({
loader: { provide: TranslateLoader, useClass: CustomLoader }
}),
AsyncLocalStorageModule,
LazyLoadImageModule
]
Issue - As per above implementation, I am not able to see icons left to label in side menu.
Any help is appreciable.