Search code examples
angulartypescriptdevextremedevextreme-angular

Value doesn't work when I try to display the name


I am using a selectbox to select a name from a list.

I am trying to put a source value in the selectbox using the value but nothing is appearing to me. Does anyone know how I can submit a root name without having to make a selection?

Demo

html

  <div *ngFor="let datas of array">
    <dx-select-box [value]="datas.name"> </dx-select-box>
  </div>

Solution

  • That is the incorrect syntax for DevExtreme select box. You need to pass the value to valueExpr and the display value to displayExpr like below. There is no need for ngFor with dx-select-box. Instead, you just need to pass the array to items.

    <dx-select-box [items]="array" valueExpr="id" displayExpr="name"></dx-select-box>