Closed marxsk closed 3 years ago
Hey @marxsk,
Point 1:
Yeah, I think you can manage this easily without adding any extra arrangements. You can change the menu item's disabled property whenever the application detects the role change. You can refer to this issue #8 and let me know if it works for you.
Point 2: You are absolutely correct. Right now, there is no way we can know the ID of menu items, I should’ve added something like what you are suggesting.
Yes, A PR would be lovely. You can add @output
named as (menuIsReady)
and this event/callback will return menus array with all information.
Thanks Shashank
1) ah, I though that disabled is about not being able to click on the item. In my case they are not displayed at all. I will give it a try
2) ok, I will prepare PR
Hi @marxsk
ah, I though that disabled is about not being able to click on the item. In my case they are not displayed at all. I will give it a try
Please try it and if it doesn’t work you can share the the https://stackblitz.com/ demo, so that I will also check it.
ok, I will prepare PR Awesome
Thanks
(1) ok, so I was right :) and you as well. The issue is that there is not only "disabled" property [that acts as expected; so item is visible but cannot be activated] but there is also "hidden" propert [that acts as expected].
Fixed in 5.5.2.
Thanks, it works
Hi, thanks for a nice module.
In the current setup, it is a bit more complex task to work with menu that (might) change. It is possible that there is a better way of how to do it. If not, I'm willing to prepare PR if you wish :)
In our case, the menu items are enabled/disabled based on the user role. So we have "all" menu items that is afterwards filtered to get something what user should see. We have add 'permission' property but having function() that can check if item should be visible. Would be probably nice as well. If this is not out of scope of the module, which version would you prefer?
Let assume that we have correct menu items. In order to "select" proper menu item, we should use service.selectMenuByID(id) but in order to do this we need to know the ID. This ID is randomly generated but we don't have a direct way how to get information that menu-items data were changed and ID is now included so we can do proper mapping. I suggest to either not generate ID when id is in the source data or to have @output idGenerated() so we can run after code after the data are initialized.