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

ng-select not correctly selecting item when selecting by typing #9266

Closed
dmcconnell86 opened this issue Sep 25, 2014 · 2 comments
Closed

ng-select not correctly selecting item when selecting by typing #9266

dmcconnell86 opened this issue Sep 25, 2014 · 2 comments

Comments

@dmcconnell86
Copy link

There is an issue with selecting an item in ng-select when the options are ordered alphabetically. This issue only occurs if you select the item by typing. In the example below, if you focus on the text box then tab into the select, pressing 's' correctly selects Satchel, press 's' again and the selected option stays as satchel. If you keep pressing s, it works correctly. This appears to only happen on the second input change (ie. Satchel to Skid the first time).

The UI correctly changes the selected item type but it doesnt update in the scope. In the example I have added a ngChange that writes the selected item to the console. This method does not get hit when changing from satchel to skid for the first time.

<input ng-model="test"/>
<select data-ng-model="selectedItemType" data-ng-options="val.name for val in itemTypes" ng-change="itemTypeChanged()"></select>
(function () {
    'use strict';
    app.controller('test2', test);
    test.$inject = ['$scope'];
    function test($scope) {
        $scope.itemTypes = [
            {
                id: 1,
                name: "Satchel"
            }, {
                id: 2,
                name: "Skid"
            }, {
                id: 3,
                name: "Stillage"
            }
        ];
        $scope.itemTypeChanged = function() {
            console.log($scope.selectedItemType.name);
        }
    }
})()
@gkalpak
Copy link
Member

gkalpak commented Sep 25, 2014

This is a duplicate of #9134.

@Narretz
Copy link
Contributor

Narretz commented Sep 25, 2014

@gkalpak is right, this is a duplicate. It seems to be a browser bug. Feel free to provide additional info in the issue mentioned.

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

3 participants