How to Show/Hide Elements Based on User Roles with Ionic [v4]

ionic-4-role-based-elements-header

When you build an authentication system for your app it’s very likely that you also have some sort of role management. If you want to show or hide different elements in your Ionic app based on a role, this is for your.

In this Quick Win we will use a dummy auth service (so no real backend) but a real directive that will accept a role as input and automatically checks if the user has the role and display the component then.

ionic-4-role-auth

We will have a user and admin, and we’ll also quickly add some animations but let me know below if you’d like to see more content on animations!


ionic-academy-start

You must be a Member to view this Quick Win

Access all courses and lessons, track your progress, connect with Developers & build awesome Ionic Apps.


Leave a Reply

Your email address will not be published. Required fields are marked *