angular-keyboard icon indicating copy to clipboard operation
angular-keyboard copied to clipboard

Error when I click on a dropdownlist with angular-keyboard !

Open jcstritt opened this issue 10 years ago • 3 comments

Hello. I use Angular-keyboard with a dropdownlist from bootstrap in an AngularJS directive. Sometimes when i clik on a dropdownlist, i have this message that appear :

TypeError: Cannot read property 'name' of undefined
    at http://code.gampleman.eu/angular-keyboard/grunt-scripts/angular-keyboard.js:1257:35
    at Object.forEach (https://ajax.googleapis.com/ajax/libs/angularjs/1.2.26/angular.js:332:20)
    at select (http://code.gampleman.eu/angular-keyboard/grunt-scripts/angular-keyboard.js:1252:13)
    at _checker (http://code.gampleman.eu/angular-keyboard/grunt-scripts/angular-keyboard.js:1293:13)
    at getSelection (http://code.gampleman.eu/angular-keyboard/grunt-scripts/angular-keyboard.js:1294:13)
    at Object.$watchCollectionAction [as fn] (https://ajax.googleapis.com/ajax/libs/angularjs/1.2.26/angular.js:12410:13)
    at Scope.$digest (https://ajax.googleapis.com/ajax/libs/angularjs/1.2.26/angular.js:12541:29)
    at Scope.$apply (https://ajax.googleapis.com/ajax/libs/angularjs/1.2.26/angular.js:12806:24)
    at https://ajax.googleapis.com/ajax/libs/angularjs/1.2.26/angular.js:14314:36
    at completeOutstandingRequest (https://ajax.googleapis.com/ajax/libs/angularjs/1.2.26/angular.js:4397:10) 

Here's the partial code in the dropdownlist template : image

I have found that's the problem is coming when two dropdownlists are in same view and when i click one when the other is open. Have you any idea for this issue?

jcstritt avatar Nov 17 '14 16:11 jcstritt

With this correction, all is ok when you have more than one Angular-UI dropdownlist : image

jcstritt avatar Nov 18 '14 12:11 jcstritt

Can you post a jsfiddle or plunkr which reproduces the issue?

gampleman avatar Nov 18 '14 13:11 gampleman

Would be nice if this were fixed, since it looks fairly easy. It's not a show stopper, but is annoying to see the errors.

Here is a jsfiddle illustrating the problem: https://jsfiddle.net/tg1jr9o3/4/

It happens when you empty the initial array used in the ng-repeat for a selectable. In my case, I want to use the selectable in a dynamic modal to choose search results. The results model is cleared when the user either selects a choice or cancels the modal.

kevinrstone avatar Sep 08 '16 19:09 kevinrstone