Lucas Mengual
Lucas Mengual

Reputation: 415

Show and hide button when value is true in AngularJS

I got an application which uses the 'oidc-client' module, which redirects and if logged in properly in that website I return the value {{auth?.loggedIn}} in my HTML. This value can either be true or false.

What I´m trying to do is to show a second button only when the value {{auth?.loggedIn}} is true. And when the value is false. Been trying with the ng-hide method and then function to check, but doesn´t do anything.

Here´s my HTML part:

<button (click)="onLogin()" class="btn btn-lg btn-primary btn-block">SSO Login</button>
Currently Logged In?  {{auth?.loggedIn}}
Logged in as:  {{currentUser?.profile?.email}}
<button type="submit" class="btn btn-lg btn-primary" onclick="window.location.href='/secondpage'">Go to second page</button>

Upvotes: 1

Views: 193

Answers (1)

Denis
Denis

Reputation: 104

Try to use ng-if='true/false' do not use {{}} in directive

Upvotes: 1

Related Questions