无法在 push.6044.ColorPickerComponent.ngOnInit 读取未定义的属性(读取"本机元素")



我正在使用colorpicker来选择颜色,但我无法选择任何颜色。我得到了上面提到的错误。

<div class="col-sm-12 col-md-6">
<mat-form-field class="example-full-width">
<input matInput [(value)]="color" [cpOutputFormat]="'hex'" autocomplete="off" [(colorPicker)]="color"
[cpPosition]="'bottom'" placeholder="BG Color" formControlName="color"/>
</mat-form-field>
</div>

我还导入了它的模块

import { ColorPickerModule } from 'ngx-color-picker';

您是否检索AppointmentTypeModalViewChild装饰器或类似的距离?

尝试在ngAfterViewInit中调用initializeFormFields方法,而不是ngOnInit。

最新更新