在Angular 2中提交vs ngSubmit [英] submit vs ngSubmit in Angular 2
本文介绍了在Angular 2中提交vs ngSubmit的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
为了在Angular 2中提交表单,我们可以使用表单的"submit"或"ngSubmit"事件.
In order to submit a form in Angular 2 we can either use form's "submit" or "ngSubmit" event.
<form #frm="ngForm" (submit)="add(frm.value)">
...
</form>
<form #frm="ngForm" (ngSubmit)="add(frm.value)">
...
</form>
想知道两者之间有什么区别吗?
Would like to know whats the difference between the two ?
推荐答案
查看全文