blur in forms

12 views
Skip to first unread message

Stéphane Ancelot

unread,
Jan 28, 2019, 9:43:57 AM1/28/19
to Angular and AngularJS discussion
Hi I don't manage to use blur in angular 6.2 forms, what can be wrong ??

        <div class="form-group">
                <div class="input-group">
                  <input type="text" class="form-control" placeholder="course"       [(ngModel)]="model.course"  name="course" [ngModelOptions]="{updateOn: 'blur'}" >
                  <input type="text" class="form-control" placeholder="Axe" [(ngModel)]="model.Axe" name="axe" >
                </div>
      </div>

Regards,
Steph

Sander Elias

unread,
Jan 28, 2019, 10:46:37 AM1/28/19
to Angular and AngularJS discussion

Hi Stéphane,

You don’t set it on the model, but on the form, see the docs

Like this:

<form [ngFormOptions]="{updateOn: 'blur'}">
   <input name="one" ngModel>  <!-- this ngModel will update on blur -->
</form>

Regards
Sander

Reply all
Reply to author
Forward
0 new messages