Значение модели Angular ng-select controlvalueaccessor всегда не определено
Я использую ng-select в качестве пользовательского элемента управления формой и использую controlvalueaccessor.
когда я пытаюсь установить значение из родительского компонента, метод WriteValue в дочернем компоненте не получает обновленное значение модели.
Родительский компонент:
this.selectedEntityItems = ["a", "b", "c"];
<child-component
[config]="{ getPage: getSelectInfinitePage(), multiple: true }"
[(ngModel)]="selectedEntityItems" //the new values set to this variable is not getting updated in child component
[disabled]="!hasSubjectType"
[placeholder]="placeholderText"
name="selectInfinite"
(onChange)="onCustomItemChange()"
>
</child-component>
дочерний компонент:
publi writeValue(preselectedValues: string[]): void {
this.values = preselectedValues; //preselectedValues is always coming as undefined
this.onModelChange(this.values);
}