Schema for logged user routes (private routes)


#1

Hello, I am new to Ionic but not to angular (quite new to ui-router tho).

In desktop, I have two abstract states, one for anonymous users, one for logged in users. From there I define new states hanging from one of those abstract. I tried to replicate that on Ionic.

I give you a plunker to see it in action: http://plnkr.co/edit/vPw4Ufp39DfDfbBqUX8m?p=preview

There you can see I have two anonymous routes which are working correctly and then a tab for a user route. When you click on that private route (since I don’t have any auth done yet) you simply get into that route (that works on the plunker). In the real ionic app I have, when I click on the private route, I get redirected back to /home (I can see the URL changing for a second but then a redirect to home).

The ui-sref is correct (if I change it, I just get a black page, not a redirect) and the state is there as well. Also as I said it works perfect in plunker and the code is just copy and paste.

Oh wait, if you change (I let you do it by hand, to see the difference) the version from beta6 to beta13 on the plunker, it starts failing.

Anything changed from beta6 to beta13 that needs a change on that code? Am I doing it wrong?

I am open for alternative solutions for that.

Thanks.

EDIT: Seems to happen in beta12 (which also gives a run error)


#2

Seems to be fixed in master now.