Skip to content

Commit ed78f44

Browse files
Fix li click event
Previously, I couldn't click a list item with my mouse. This patch lets the user click the list item to select it. Remove check for equal value This was stopping the initially selected value from being set Fix selecting on mouse enter remove console log
1 parent f4406e6 commit ed78f44

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

inputDropdown.js

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ angular.module('inputDropdown', []).directive('inputDropdown', [function() {
1414
'<ul ng-show="dropdownVisible">' +
1515
'<li ng-repeat="item in dropdownItems"' +
1616
'ng-click="selectItem(item)"' +
17-
'ng-mouseenter="setActive($index)"' +
18-
'ng-mousedown="dropdownPressed()"' +
17+
'ng-tap="selectItem(item)"' +
18+
'ng-mousedown="selectItem(item)"' +
1919
'ng-class="{\'active\': activeItemIndex === $index}"' +
2020
'>' +
2121
'<span ng-if="item.readableName">{{item.readableName}}</span>' +
@@ -75,7 +75,6 @@ angular.module('inputDropdown', []).directive('inputDropdown', [function() {
7575
scope.$watch('selectedItem', function(newValue, oldValue) {
7676
inputScope.updateInputValidity();
7777

78-
if (!angular.equals(newValue, oldValue)) {
7978
if (newValue) {
8079
// Update value in input field to match readableName of selected item
8180
if (typeof newValue === 'string') {
@@ -85,11 +84,6 @@ angular.module('inputDropdown', []).directive('inputDropdown', [function() {
8584
scope.inputValue = newValue.readableName;
8685
}
8786
}
88-
else {
89-
// Uncomment to clear input field when editing it after making a selection
90-
// scope.inputValue = '';
91-
}
92-
}
9387
});
9488

9589
scope.setInputActive = function() {

0 commit comments

Comments
 (0)