Skip to content
This repository has been archived by the owner on May 30, 2022. It is now read-only.

Commit

Permalink
fix(macAutocomplete): Fixed not able to select item when clicking on …
Browse files Browse the repository at this point in the history
…dropdown

Fixes #174
  • Loading branch information
adrianlee44 committed Jun 25, 2014
1 parent ad3f470 commit 62e7664
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/directives/autocomplete.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,8 @@ angular.module("Mac").directive "macAutocomplete", [
Create a click handler function to make sure directive is unbinding
the correct handler
###
clickHandler = -> reset(true)
clickHandler = ->
$scope.$apply -> hide()

###
@function
Expand All @@ -174,9 +175,13 @@ angular.module("Mac").directive "macAutocomplete", [
@description
Resetting autocomplete
###
reset = (invokeApply = false) ->
reset = ->
$menuScope.items.length = 0

hide()

hide = ->
$animate.leave menuEl, ->
$menuScope.items = []
$menuScope.index = 0

# Clear menu element inline style
Expand All @@ -187,8 +192,6 @@ angular.module("Mac").directive "macAutocomplete", [

element.unbind "blur", clickHandler

$scope.$apply() if invokeApply

return

###
Expand Down Expand Up @@ -327,7 +330,7 @@ angular.module("Mac").directive "macAutocomplete", [

when keys.ESCAPE
$scope.$apply ->
reset()
hide()

event.preventDefault()

Expand Down

0 comments on commit 62e7664

Please sign in to comment.