I'm started to develop in angularJs and I'm struggling on the view partial changing logic.
I'm using ui-router module and I have configured a public and an app abstract state and all of states are child states of these.
// public does not require the user to be authenticated, but app does //
Both states have view partials, header, footer, content, which are related to the login status and of course the content is configured per state.
My problem is that I can't see a logic for placing the in the index.html only in the way like:
<body ng-app="myapp">
...
<div ng-hide="isUserAuthenticated()">
<!-- the public state and its childs' ui-view loading here -->
</div>
<div ng-show="isUserAuthenticated()">
<!-- the app state and its childs' ui-view loading here -->
</div>
...
</body>
I'm running the authentication on each state change in angular.module('myapp',[]).run() method so the authentication is done.
My question is, that is there a better practice for switching between public and app views?
Thanks in advance
update
I'm closing this question. This was a research for any better solution for a problem of un/authorized views strategy in AngularJS.
Btw as the time goes there could be other might better ways to do it so if you have other point of you, feel free to share with us.