【发布时间】:2020-02-20 09:48:47
【问题描述】:
就像this issue states,如果您尝试使用指令访问 ngControl.control:
export class DisabledDirective {
@Input()
set opDisabled(condition: boolean) {
const action = condition ? 'disable' : 'enable';
this.ngControl.control[action]();
}
constructor(private ngControl: NgControl) {}
}
第一次渲染时会报错:
core.js:5828 ERROR TypeError: Cannot read property 'disable' of undefined
【问题讨论】:
标签: angular angular9 angular-ivy