Hello
I am trying to render a custom property on the side bar menu dynamically
My version is the most recent one, running on Angular + ASP.Net core
I created a new entity which has CRUD functionality, I want each item in the new entity to be a child item in the sub menu. However, when I add a new item or delete one, the side bar menu stays the same until I manually refresh the page.
I am trying to make this part of the side bar menu dynamic so that when I delete something, it disappears from the side bar menu and the same for when I add an item, I want it to appear dynamically in the side bar menu as well. Without having to refresh the page
I've tried different things inside the side-bar-menu.component.ts
along with inside the app-navigation.service.ts
file but nothing
seems to do the trick
Can anyone help me?
Example below:
Now i'll add an item through the file uploader I have.
The file appears in the main component however, I would like it to dynamically appear in the sidemenu I have marked in the upper left corner
Now when I manually refresh the whole page it looks like this, as it should
And now lets say I delete the file I just recently added, it still is in the sidemenu
I hope someone understands my question, this is driving me nuts because I'm pretty sure this has something to do with the menu: AppMenu
variable in side-bar-menu.component.ts
but I do not know what to do
2 Answer(s)
-
0
Hi @capacent
When a file is added or deleted, you should fire an event and on hangdling the event, you should re-render the Menu. You can use https://aspnetboilerplate.com/Pages/Documents/Javascript-API/Event-Bus
-
0
This worked for me, thank you for your help!