1

What i want is on refresh the page i want to get the value from API and add as selected in the select list. Here the syntax

<ngx-dropdown-list (selectionChange)="onChange($event)"
                   [items]="optionItems"
                   [multiSelection]="false"
                   [placeHolder]="'place holder of the drop-down list'"
                   [(selectedValue)]="maxRowsLimitation"
                   [suffixText]="' suffix text'"
                   [filterBox]="false"
                   [formatNumber]="true"
                   [disabled]="false">
</ngx-dropdown-list>

How i can the add the selected value from the list from component ts file?

rajwa766
  • 604
  • 13
  • 31

1 Answers1

2

I have analysis your issue and the solution is to add selected property should be set to true in your object.

Kindly check this link https://stackblitz.com/edit/angular-ivy-mdpelb?file=src%2Fapp%2Fapp.component.ts

optionItems = [
  {id: 'Max',     value: 'Max',     text: 'Maximum'},
  {id: 'Average', value: 'Average', text: 'Average'},
  {id: 'Sum',     value: 'Sum',     text: 'Total', selected:true},
  {id: 'Last',    value: 'Last',    text: 'Last'}
];
Muthupriya
  • 345
  • 1
  • 10