Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

ng-model does not update displayed select value on Chrome/Android #7986

Closed
jacekwasowski opened this issue Jun 25, 2014 · 11 comments
Closed

Comments

@jacekwasowski
Copy link

Chrome v35.0.1916.141
Android 4.2.2
Angular 1.2.18

When changing the value of select the model is properly updated, however select keeps displaying the old value until it loses focus.

<select name="x" ng-model="x">
<option>1</option>
<option>2</option>
</select>
@rodyhaddad
Copy link
Contributor

Is this Android 4.2.2 specific?
Did it work in older versions of Angular?

@arty-name
Copy link
Contributor

Actually today it looks even deeper down the stack. Just changing orientation causes the select to display the right value. Same effect has blur. Most likely this is a Chrome rendering bug.

@btford
Copy link
Contributor

btford commented Jul 23, 2014

Please:

  1. Provide a reproduction via plnkr.co or jsfiddle.
  2. Check that the problem persists after updating Angular.

This saves us a lot of time. Thanks!

@btford btford added this to the Backlog milestone Jul 23, 2014
@diegomesata
Copy link

I have the same issue if I have together on the same page a select and a ng-grid (current version 2.0.11).
Angular version 1.2.21
Chrome mobile 36.0.1985.131
Android 4.2.2

@btford btford removed the gh: issue label Aug 20, 2014
@theronin
Copy link

theronin commented Sep 9, 2014

I can submit the following information regarding this bug as we are having the same problem:

  • It's not specific for Android version.
  • It's not specific for Angular version, (we've tried multiple versions) in the 1.2.* span.
  • It's not specific for Chrome version.

Opera also has the same issue, but not Firefox.

@theronin
Copy link

We found our issue. It was that Chrome doesn't change the display value until the object is blured. We solved it by forcing a blur on ng-change. Check if that might be the same issue that's causing your behaviour as well.

@pencilcheck
Copy link

Just in case people don't understand what @theronin means, here is a sample snippet (I am using ng-classify, it's awesome)

class ForceBlur extends Directive
  # https://github.com/angular/angular.js/issues/7986
  constructor: () ->
    return {
      restrict: "A"
      require: 'ngModel'
      link: (scope, elem, attrs, ctrl) ->
        if ctrl and ctrl.$viewChangeListeners
          ctrl.$viewChangeListeners.push () ->
            $(elem).blur()
    }

@fgrs
Copy link

fgrs commented Oct 29, 2014

same issue here, rotating the phone or clicking away seems to help updating select field but thats not an option, @jacekwasowski have you found a good workaround?

@jacekwasowski
Copy link
Author

In our case we blur the select on change.

@risingfish
Copy link

There is a bug filed with the Chromium project for this at https://code.google.com/p/chromium/issues/detail?id=415505 . The more folks who star it the higher it will bubble up.

@Narretz
Copy link
Contributor

Narretz commented Sep 22, 2015

Dupe of #4836
@risingfish is right, let's star the issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

10 participants