Authenticated User Content

Restrict content based on an authenticated user in your app's custom HTML page. Use an AngularJS ngIf statement to display certain content based on a user's login status.

Only for logged in users

*ngIf="user"

Only for logged out users

*ngIf="!user"

Custom HTML template sample

<div *ngIf="user">
    <h2 *ngIf="user.username">Hello, {{ user.username }}</h2>
    <p>A logged in user can see this</p>
</div>
<div *ngIf="!user">
    <!-- login link -->
    <p><a href="#!" (click)="loginModal()">Please login</a> to view member only content.</p>

     <!-- login button -->
    <p><button ion-button large type="button" (click)="loginModal()">Login</button></p>
</div>