How to set a preselected option with Nebular, nb-select

Fealo picture Fealo · May 15, 2019 · Viewed 9.4k times · Source

https://akveo.github.io/nebular/docs/components/select/overview#nbselectcomponent

Is it possible to have a preselected value when the page is loaded ?

Answer

El7or picture El7or · Feb 3, 2020

try this:

<nb-select id="theme" [selected]="currentTheme" (selectedChange)="changeTheme($event)" status="primary">
        <nb-select-label [innerHtml]="selectedTheme"></nb-select-label>
        <nb-option langg *ngFor="let theme of themes" [value]="theme.value"> {{ theme.name | langg }}</nb-option>
      </nb-select>