I try to make a directive to enable/disable a form. I found a solution for control by doing this code:
export class DisableControlDirective {
@Input() set appDisableControl(condition) {
const action = condition ? 'disable' : 'enable';
this.ngControl.control[action]();
}
constructor(private ngControl: NgControl) { }
}
Is there an equivalent to NgControl injection to access to FormGroup ?
<form
[formGroup]="group" <!-- Access to this -->
[appDisableGroup]="!isEditable" <!-- From this -->
></form>