我有4个输入和1个禁用的按钮
<input type="text">
<input type="text">
<input type="text">
<input type="text">
<input type="button" disabled="true">
如何在填写所有字段后从按钮中删除属性。关于输入和改变的其他事件。
答案 0 :(得分:1)
使用离子验证
https://ionicframework.com/docs/developer-resources/forms/
查找此行及其示例:
<button ion-button type="submit" [disabled]="!todo.valid">Submit</button>
答案 1 :(得分:1)
您可以使用FormGroups
来完成此操作app.component.html
<form [formGroup]="mygroup" >
<input type="text" formControlName="input1">
<input type="text" formControlName="input2">
<input type="text" formControlName="input3">
<input type="text" formControlName="input4">
<input type="button" disabled="true" type="submit" [disabled]="!mygroup.valid">
</form>
app.component.ts
import { Component } from '@angular/core';
import {Validators, FormBuilder, FormGroup } from '@angular/forms';
export class FormsPage {
private mygroup : FormGroup;
constructor( private formBuilder: FormBuilder ) {
this. mygroup = this.formBuilder.group({
input1: ['', Validators.required],
input2: ['', Validators.required],
input3: ['', Validators.required],
input4: ['', Validators.required],
});
}
}