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.

ibm-select doesn't follow ngModel

See original GitHub issue

<ibm-select [(ngModel)]=“selected”> doesn’t update the selected option

Detailed description

Describe in detail the issue you’re having.

Using ngModel to initialise selected option for ibm-select doesn’t update the component. I see the issue has been reported previously and marked as resolved for example, https://github.com/IBM/carbon-components-angular/issues/1536

Is this a feature request (new component, new icon), a bug, or a general issue? Bug

Is this issue related to a specific component? ibm-select

What did you expect to happen? What happened instead? What would you like to see changed? change selected option programatically

What browser are you working in? latest Chrome/Safari

What version of the Carbon Design System are you using? “carbon-components”: “^10.31.0”, “carbon-components-angular”: “^4.46.0”,

Steps to reproduce the issue

<div style="width: 165px;">
  <ibm-select [(ngModel)]="selected">
    <option value="option1">Option 1</option>
    <option value="option2">Option 2</option>
    <option value="option3">Option 3</option>
  </ibm-select>
  <br />
  <span>Selected: {{ selected }}</span>
</div>

Sandbox https://codesandbox.io/s/carbon-components-angular-forked-0y7q2?file=/src/app/app.component.html:0-275 image

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
Donisiuscommented, Jun 4, 2021

@kuroyuki @maksym-plotnikov sorry for the delay and thank you for creating the sandbox, it seems like @ViewChild was not getting the right reference in a production build for the select element. I’ll open a PR soon to fix this.

0reactions
maksym-plotnikovcommented, Jun 7, 2021

@Donisius much appreciated for a quick turnaround!

Read more comments on GitHub >

github_iconTop Results From Across the Web

select ngmodel not binding the variable - Stack Overflow
I think you're missing the use of the ngValue directive here to have the object reflected in the value bound to ngModel ....
Read more >
default is not selected · Issue #1798 · carbon-design ... - GitHub
I use Select component with reactive form. The form contains default value of select. ... ibm-select doesn't follow ngModel #1776.
Read more >
Two-Way Data Binding in Angular with ngModel - Infragistics
Learn how two-way data binding in Angular is used to display information to the end user and allows them to make changes to...
Read more >
ngOptions - AngularJS: API
By default, ngModel watches the model by reference, not value. This is important to know when binding the select to a model that...
Read more >
IBM Security AppScan Standard: User Guide
Select Uninstall IBM Security AppScan Standard and follow the instructions. ... Actions to be skipped are identified based on the Id, name or...
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