angular - angular2 submit form by pressing enter without submit button -


is possible submit form not have submit button (by pressing enter) example :

<form [ngformmodel]="xxx" (ngsubmit)="xxxx()">   <input [(ngmodel)]="lxxr"   ngcontrol="xxxxx"/> </form 

maybe add keypress or keydown input fields , assign event function submit when enter clicked

your template this

<form (keydown)="keydownfunction($event)">   <input type="text" /> </form 

and function inside class this

keydownfunction(event) {   if(event.keycode == 13) {     alert('you clicked enter');     // rest of code   } } 

Popular posts from this blog

php - How should I create my API for mobile applications (Needs Authentication) -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)

Google AdWords and AdSense - A Dynamic Small Business Marketing Duo