Skip to content

dynamically adding and removing sidebar menu based on admin role #143

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
swathibhe opened this issue Feb 23, 2019 · 11 comments
Closed

dynamically adding and removing sidebar menu based on admin role #143

swathibhe opened this issue Feb 23, 2019 · 11 comments

Comments

@swathibhe
Copy link

swathibhe commented Feb 23, 2019

Hi,
Please help to solve this problem asap.
I am using angular 6 and coreui/angular to ^2.4.3
Based on admin role i have to change the _nav.ts data dyamically.
I have 5 roles in admin using this combination of more than one role, single role and all roles based on this i have to display the sidebar menu.
How to i solve this problem . Please help me

@swathibhe swathibhe changed the title dynamically adding and removing sidebar menu based on admins dynamically adding and removing sidebar menu based on admin role Feb 23, 2019
@xidedix
Copy link
Member

xidedix commented Feb 23, 2019

Hi @swathibhe
_nav.ts returns a plain simple js object to populate sidebar-nav
you can write an angular service to set up dynamically altered copy of this nav config object
one more thing - treat app routes in a similar manner with route guards, I suppose

@swathibhe
Copy link
Author

Hi,
I added the dynamically in service file. side menu works correctly but i can not understand how to add this in routing file.
Please look in to this.

@xidedix
Copy link
Member

xidedix commented Feb 25, 2019

@swathibhe
Your sidebar nav service works for the sidebar menu according to a user-specific role. Standard user can't see admin menu entries and that's fine. But the admin area is still available using the address bar. That's why we need to use route guards and restrict access to some features depending on user role.

@fgenao-cuore
Copy link

could you share how you dynamically adding and removing sidebar menu?

@swathibhe
Copy link
Author

Hey, thanks for the response. I got the solution it's completed.

@fgenao-cuore
Copy link

fgenao-cuore commented Oct 4, 2019 via email

@vvp45
Copy link

vvp45 commented May 28, 2020

@swathibhe Can you help me in the side-nav bar, hide menu after user login. I am in new in angular.
I how to make the dynamic navbar

@swathibhe
Copy link
Author

swathibhe commented May 30, 2020 via email

@Megha-008
Copy link

Hi,
The sidebar loads only after login,how to make it load on every page,based on the page click i need to change the sidebar in coreui.

@xidedix
Copy link
Member

xidedix commented Jul 2, 2020

Hi @Megha-008

_nav.ts returns a plain simple js object to populate sidebar-nav
you can write an angular service to set up dynamically altered copy of this nav config object

@ngingihy
Copy link

Hi i'm trying to mimic the _nav.ts by creating a service that subscribe to my backend

public navItems: INavData[]

getNav(){
this.navItems = this.dynservice.getNavItem()
}

but nothing is reflected on the navbar, what should i do?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants