Showing navigation only after login


#1

I took the “tabs” template.
I’d like to have a full screen login page before the user can access the app.

I’ve tried to add “ng-show” to the auto-generated ion-nav-bar and ion-nav-view elements.
They disappear, but nothing in the add works, it becomes unresponsive.

What is the best way to do this?


#2

Maybe this codepen by Ionic will help: http://codepen.io/ionic/pen/CbBsA


#3

Thank you it helped a lot!

In the same idea, I wouldn’t like my other URLs to be accessible if you are not logged in.
I created a service with a variable loggedIn. I set it to true when I click the login button.

Then I thought in all my controllers to do a if(!loggedIn) redirect to /login

But it seems overkill to do this everywhere no?
Can’t this be done at the Router level maybe?


#4

I haven’t personally done a login yet, but there are some posts on this. It looks like there are several ways to do it in the replies: