In an angularjs application, is it possible to use a different (index.html?) for login page and use another index.html page for rest of the pages in the application?
2 Answers
It is possible, however you can also use ng-if on the login html code and the regular html code:
<div ng-if="userLoggedIn">
<login page html>
</div>
<div ng-if="!userLoggedIn">
<regular page html>
</div>
Which will show one of the divs according to what is set as $scope.userLoggedIn in your main controller.
Comments
also you can use ng-show and ng-hide
<div ng-show="userLoggedIn">
<login page html>
</div>
<div ng-hide="!userLoggedIn">
<regular page html>
</div>
1 Comment
David H.
ng-show and ng-hide actually load the html and set display:none. This means that even if you are not logged in, the regular html page will still get loaded, then it will be hidden once the scope variables are set.