Angular 2 prevent enter from submitting in template-driven form

后端 未结 9 1594
故里飘歌
故里飘歌 2021-02-01 11:54

I have forms that uses the template-driven blueprint, so something like this:

&
9条回答
  •  礼貌的吻别
    2021-02-01 12:11

    Use:

    
    

    And it'll prevent tag and what is in this tag from submitting enter and shift + enter.

    For example: It worked this for me:

    And after this, everything under this excample div are prevented from submitting enter and shift + enter.

    More info about key combinations: https://alligator.io/angular/binding-keyup-keydown-events/#key-combinations

提交回复
热议问题