Display tab to specific users only

Let’s assume I have an tabbed based app with a login system and a navigation with Home, Public and Secret.

Is it possible to hide the Secret Tab if a ‘normal’ user is logged in (so that he only sees Home and Public) and only display the Secret tab to specific users like the admin?

I have done it in Angular not in Ionic but I guess it should be the same.

Usually, this is implemented using roles/permissions that are assigned by your server when authenticating then you could use roles in several paways:

  • to hide/show parts of your application by using ng-hide/ng-show with hasRole(…) conditions
  • defining authorized roles per angular-ui state

Of course, your server must also apply roles when you request data through $resource services. It means that your templates should not contain any sensible data, it should always come from your server.

Have a look at angular-permission