Hi
I try to create a dynamic menu, but I'm not able.
I've always the same status at the point I start the application
Can you give me more information and create an example please
Thx
Rolf
Dynamic items in menu
Forum rules
Please note that response time for technical support is within 3-5 business days.
Please note that response time for technical support is within 3-5 business days.
@tbegsr,
There are already 2 examples you can follow in this topic so I don't see how posting another will help. Basically you need to change the model object that the menu is using or Angular will not detect the change. If you are setting the visible property of a menu item to be a Boolean variable and then changing the value of the variable, then this will not work as the model itself has not changed and therefor will not be detected.
There are already 2 examples you can follow in this topic so I don't see how posting another will help. Basically you need to change the model object that the menu is using or Angular will not detect the change. If you are setting the visible property of a menu item to be a Boolean variable and then changing the value of the variable, then this will not work as the model itself has not changed and therefor will not be detected.
@tbegsr,
I actually created a MenuService class for the showHideMenuItems() function as this allows it to be called from anywhere in the application. I build the menu model object within the MenuService as well. I declare the MenuService as a provider in AppModule and initially call it's methods in the ngOnInit() method of the AppMenuComponent.
I actually created a MenuService class for the showHideMenuItems() function as this allows it to be called from anywhere in the application. I build the menu model object within the MenuService as well. I declare the MenuService as a provider in AppModule and initially call it's methods in the ngOnInit() method of the AppMenuComponent.
to create dynamic menu this is working for me
categoryList is a list of item that is fetch from the DB
categoriesList: Category[];
items: MenuItem[];
item: MenuItem;
for (const i in this.categoriesList) {
this.item = {label: this.categoriesList.categoryName};
this.items.push(this.item);
}
categoryList is a list of item that is fetch from the DB
categoriesList: Category[];
items: MenuItem[];
item: MenuItem;
for (const i in this.categoriesList) {
this.item = {label: this.categoriesList.categoryName};
this.items.push(this.item);
}
-
- Information
-
Who is online
Users browsing this forum: No registered users and 6 guests