'Angular value updated in parent component, is not reflected in child component
I have a custom control child component. When i try to set a value updated in parent component, the child is not getting the updated value. Please let me know what i am doing wrong here.
parent .html
<child-component
[config]="{ getPage: getSelectInfinitePage(), multiple: true }"
[(ngModel)]="selectedEntityItems" //in the child compoennt, this always coming as empty
[disabled]="!hasSubjectType"
[placeholder]="placeholderText"
name="selectInfinite"
(onChange)="onCustomItemChange()"
>
</child-component>
parent .ts
this.selectedEntityItems = ['a', 'b', 'c'];
Child component .ts (custom control using ControlValueAccessor)
writeValue(preselectedValues: ValueType): void {
this.values = preselectedValues; //here it is always coming empty
this.onModelChange(this.values);
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
