1

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>

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks! And how would I link the button object with the value from auth?.loggedIn? Sorry I´m not great at angular (actually first project).
may be <button type="submit" class="btn btn-lg btn-primary" ng-if='auth?.loggedIn' onclick="window.location.href='/secondpage'">Go to second page</button> if auth?.loggedIn is available

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.