formbuilder disabled code example
Example 1: how to set disabled flag formgroup angular
this.form.controls['name'].disable();
// or
<input formControlName="id" placeholder="ID" [attr.disabled]="true"></input>
Example 2: disable control with formbuilder
this.userProfileForm = this.formBuilder.group({
// ...
password: [{
value: null,
disabled: !this.isResetPassword
}],
newPassword: [{
value: null,
disabled: !this.isResetPassword
}],
reTypePassword: [{
value: null,
disabled: !this.isResetPassword
}]
});