-1

I am populating Ngselect dropdown with 20 values coming while open the dropdown. and on scroll it fetches 20 more values (pagination).

Its working fine, but if I select few values from first(page) list, then scroll, and then select values form second(page) list, it will show first page selected values as [ObjectObject].

<ng-select 
    [items]="attribute.codedValues"
    [virtualScroll]="true" 
    [placeholder]="attribute.isRequired ? attribute.name + ' *': attribute.name"
    (focus)="hasFocus = true" 
    [typeahead]="cvSearchInput$"
    (open)="loadCodedValues(attribute, true)"
    (scrollToEnd)="fetchMoreCodedValues(attribute)"
    [disableControl]="isProductAttributeDefected || attribute.isReadOnly"
    [required]="attribute.isRequired" 
    [formControl]="specsForm.controls[attribute.id].controls.value"
    (change)="removeInvalidOption(attribute.id); openDialog($event, attribute); categoryIdentifierChanged(attribute,specsForm)">
</ng-select>

while selecting values from 2nd page

ng-select Version: 1.5.2 angualr: 5.3.5

Vega
  • 27,856
  • 27
  • 95
  • 103
Atif Hussain
  • 19
  • 1
  • 5
  • 1
    What does `attribute.codedValues` look like? – DFSFOT May 19 '22 at 12:12
  • Please create a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) showing the problem. You can use [stackblitz](https://www.stackblitz.com) to create a MRE. The good part about making a MRE is that you might end up finding the problem yourself ;) And in case you don't, people can use the MRE to check where the problem lies. –  May 19 '22 at 12:22
  • @DFSFOT It has the list of values. – Atif Hussain May 19 '22 at 13:38

1 Answers1

0

got the issue, its appending the values in formControl by adding another object. so instead of specsForm.controls[attribute.id].controls.value // not working specsForm.controls[attribute.id].controls.value.value // worked.

Atif Hussain
  • 19
  • 1
  • 5