angular2 submit form by pressing enter without submit button

Florence picture Florence · Jun 1, 2016 · Viewed 141.6k times · Source

Is it possible to submit a form that does not have submit button (by pressing enter) example :

<form [ngFormModel]="xxx" (ngSubmit)="xxxx()">
  <input [(ngModel)]="lxxR"   ngControl="xxxxx"/>
</form

Answer

sizzle picture sizzle · Jan 24, 2017

You can also add (keyup.enter)="xxxx()"