我正在使用以下表单提交:
<form [formGroup]="forgetpwdForm" (submit)="doForgetPwdRequest()">
<ion-item style="border:1px solid #CCCCCC; border-radius:0px;">
<ion-input [(ngModel)]="forgetpwdData.email" name="email" type="text" formControlName="email" placeholder="{{ 'Forgetpassword.email' | translate }}"></ion-input>
</ion-item>
<button ion-button block style="border-radius:0px; background-color:#17B97E;" type="submit" [disabled]="!forgetpwdForm.valid">
{{ 'Forgetpassword.submit' | translate }}
</button>
</form>
我发现它在提交表单时两次解雇doForgetPwdRequest(),有人有想法吗?
app.module.ts bootstraps:
bootstrap: [IonicApp],
entryComponents: [
MyApp,
LandPage,
forgetpwdPage
],
答案 0 :(得分:0)
在您的main.ts
中,您必须设置:
import {disableDeprecatedForms, provideForms} from '@angular/forms';
bootstrap(AppComponent, [disableDeprecatedForms(), provideForms()]);
请参阅此链接以供参考。 ngSubmit fires twice when submit button clicked