question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Nb-Select not emitting change event

See original GitHub issue

Nb-Select not emitting event when used with [ngModel]

I’m submitting a bug report

Issue description

Current behavior: Nb-Select does not emit (selectChange) or (ngModelChange) event when using observables with ngModel.

<nb-select (selectedChange)="onChange($event)" (ngModelChange)="onChange($event)"
    [ngModel]="selectedLocationUnitGroupId$ | async">
    <nb-option *ngFor="let option of locationUnitGroups$ | async" [value]="option.id">
        {{ option.type }}
    </nb-option>
 </nb-select>

Expected behavior: I want nb-select to emit (selectChange) or (ngModelChange) event every time user selects an option

Any ideas how to fix it?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:28 (2 by maintainers)

github_iconTop GitHub Comments

17reactions
mushu8commented, Nov 6, 2018

up plz :

<nb-select placeholder="Menu" (selectedChange)="onMenuItemSelected($event)">
    <nb-option-group *ngFor="let rootMenu of rootMenus" title="{{rootMenu.rootMenu.name}}">
        <nb-option *ngFor="let menu of rootMenu.menus" value="{{menu.id}}">{{menu.name}}</nb-option>
    </nb-option-group>
</nb-select>

data :

[
  {
    "rootMenu":{"id":0,"name":"A"},
    "menus": [
      {"id":3,"name":"B"},
      {"id":2,"name":"C"}
    ]
  }
]
7reactions
pdomalacommented, Nov 4, 2018

I am having the same issue. Nb-select does not work if the options are generated using ngFor and observables. Hardcoding nb-option tags works fine.

Read more comments on GitHub >

github_iconTop Results From Across the Web

angular - Get selected TEXT from nb-select
When the selectedChange event fires I can only get the VALUE of the selected option, but I want to get the TEXT as...
Read more >
Nebular - Select Angular UI Component - component api
Specifies class to be set on nb-option s container ( nb-option-list ). optionsOverlayOffset, number ... Will be emitted when selected value changes.
Read more >
Datepicker
The input's native (input) and (change) events will only trigger due to user interaction with the input element; they will not fire when...
Read more >
kendo dropdownlist set selected value by text - - Townhouse
As soon as I leave the grid EDIT event my dropdown list goes back to "Choose an instrument". So far dropdown editor works...
Read more >
nb-select set value
Demo: Handling Select List OnChange Event. The form below demonstrates onchange event handling in JavaScript for both select-one and select-multiple type select ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found