我有一个组件,可以从多个组件中调用。组件下方
<ion-content>
<form [formGroup]="registerForm" (submit)="onSubmit(registerForm.value)">
<ion-row>
<ion-col class="input-column" col="12">
<ion-item>
<ion-input type="password" maxlength="4" placeholder="PIN" formControlName="password" pattern="^[0-9]*$"></ion-input>
</ion-item>
<ion-icon name="medical"></ion-icon>
</ion-col>
</ion-row>
<span *ngIf="registerForm.controls.password.hasError('required') && registerForm.controls.password.touched"
class="error">*PIN is required.</span>
<span *ngIf="registerForm.controls.password.hasError('minlength') && !registerForm.controls.password.hasError('required') && registerForm.controls.password.touched"
class="error">*PIN length must be 4.</span>
<span *ngIf="!registerForm.controls.password.hasError('minlength') && registerForm.controls.password.hasError('pattern') && registerForm.controls.password.touched"
class="error">*PIN must be a number.</span>
<button ion-button full color="primary" [disabled]="!registerForm.valid" class="login" type="submit">PAY NOW</button>
</form>
在此组件中,有时如果表单有效,则无法启用按钮。在android中工作正常。但不适用于ios。