I'm writing a login form in AngularJS2 and I want cursor to focus username input when the user or password return false. How can I do it?
<input type="text" class="form-control" #inputUsername placeholder="Username" autofocus ngControl="username" [(ngModel)]="username">
<input type="password" class="form-control" #inputPassword placeholder="Password" ngControl="password" [(ngModel)]="password">
this.loginService.getAuth(username, password)
.subscribe(auth => {
if (auth == true) {
????
} else {
????
}
});