好吧,也许这还不清楚。获取此表格:
<form (ngSubmit)="submit()" #crisisForm="ngForm">
<input type="text" name="name" [(ngModel)]="crisis.name">
<button type="submit">Submit</button>
<button type="button" (click)="preview()">Preview</button>
<button type="reset" (click)="reset()">Reset</button>
</form>
为什么所有按钮都会触发该submit()
功能?以及如何避免这种情况?
1
返回false;来自您的
—
commit