Tony Roczz
Tony Roczz

Reputation: 2398

Angularjs - How to make login page load instead of index page when giving weburl

I have created a web app where the user needs to login first.

When i type the url in the address bar and press enter, i first see the contents of my index page that is the navigation bar ,interpolation code where i bind data if the user is logged in and after that it is redirected to my login page since the user is not logged in.

Is there a way to load my login page first or just hide the contents of index page till the validation for whether the user is logged in is done.

for Example: i enter localhost:3000 in the address bar

see

Welcome {{authentication.userName}}

in my nav bar.

After the validation of authentication function it is redirected to login page.

I have tried using ng-cloak but it does not work.

Or should i make login page as index.

Upvotes: 1

Views: 207

Answers (1)

Waqas Hafeez
Waqas Hafeez

Reputation: 160

how you used ng-cloak, for example if I want to hide and show the anchor tag as below I'll use ng-cloak as

<a href="javascript:void(0)" class="demographic_lenguageAdd_btn ng-cloak ng-hide" ng-show="$index >=1" ng-cloak></a>

add following css for ng-cloak

    <style type="text/css">
  [ng\:cloak], [ng-cloak], .ng-cloak {
  display: none !important;
}
</style>

hope it'll solve your problem , just add css in the file or template and use ng-cloak with css in tag where you want to hide and show.

Upvotes: 0

Related Questions