I have forms in my Angular 2 application that uses ngControl
. Example:
<label for="login-field-inputLogin" class="sr-only">Login</label>
<input
[(ngModel)]="login"
id="login-field-inputLogin"
class="form-control"
placeholder="Login"
ngControl="loginCtrl"
#loginCtrl="ngForm"
type="text"
required />
<div [hidden]="loginCtrl.valid || loginCtrl.pristine" class="alert alert-danger">Login is required</div>
Unfortunately on IE 11, when there is a placeholder, the message "Login is required" is diplayed as soon as the field gets focus.
I found a solution to this issue for AngularJS. See AngularJS / How to prevent IE triggering automatically inputs validation?
How woudl one adapt this solution to Angular 2?