Skip to content

Instantly share code, notes, and snippets.

@elmarputz elmarputz/login
Created Apr 8, 2019

Embed
What would you like to do?
<div *ngIf="!isLoggedIn()">
<h1>Login</h1>
<form class="ui large form" [formGroup]="loginForm" (ngSubmit)="login()">
<div class="field">
<label>E-Mail</label>
<input type="email" id="username" formControlName="username">
<div *ngIf="loginForm.get('username').invalid &&
(loginForm.get('username').dirty || loginForm.get('username').touched) &&
loginForm.get('username').hasError('required')" class="ui negative message">
Benutzername ist verpflichtend </div>
<div *ngIf="loginForm.get('username').invalid &&
(loginForm.get('username').dirty || loginForm.get('username').touched) &&
loginForm.get('username').hasError('email')" class="ui negative message">
E-Mail Format überprüfen </div>
</div>
<div class="field">
<label>Passwort</label>
<input type="password" formControlName="password">
<div *ngIf="loginForm.get('password').invalid &&
(loginForm.get('password').dirty || loginForm.get('password').touched)" class="ui negative message">
Passwort ist verpflichtend </div>
</div>
<button type="submit" class="ui button" [disabled]="loginForm.invalid">Login</button>
</form>
</div>
<div *ngIf="isLoggedIn()">
<button type="button" class="ui button" (click)="logout()">Logout</button>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.