set disabled attribute angular 8 in a directive 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: form control adding disabled and validators
value: string;
isDisabled: boolean;
//isDisabled and value come from your dynamic data.
fb: FormBuilder;
myGroup: FormGroup;
this.myGroup = fb.group({
form_control_name: new FormControl({
value: this.value,
disabled: this.isDisabled,
Validators.required)}
);