<form [formGroup]="form" (ngSubmit)="login()" novalidate>
<div class="form-group">
<label for="inputUserName" class="sr-only control-label">User name</label>
<input type="userName" id="inputUserName" class="form-control" placeholder="user name"
formControlName="userName" autofocus>
<div [hidden]="form.get('userName').untouched
|| !form.hasError('required', 'userName')"
class="alert alert-danger">
Please enter a valid user name
</div>
</div>
<div class="form-group">
<label for="inputPassword" class="sr-only">Password</label>
<input type="password" id="inputPassword" class="form-control" placeholder="Password"
formControlName="password">
<div [hidden]="form.get('password').untouched
|| !form.hasError('required', 'password')"
class="alert alert-danger">
Password is required
</div>
</div>
<button class="btn btn-lg btn-primary btn-block" type="submit">Log in</button>
</form>