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 $animate API changes due to AngularJS v1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianlee44 committed Dec 3, 2014
1 parent f38cb92 commit d6c69cd
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/directives/autocomplete.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,9 @@ angular.module("Mac").directive "macAutocomplete", [
@description
Adding menu to DOM
@param {Function} callback Callback after enter animation completes
@returns {Promise} Animation promise
###
appendMenu = (callback) ->
appendMenu = ->
unless isMenuAppended
element.bind "blur", blurHandler

Expand All @@ -187,18 +188,19 @@ angular.module("Mac").directive "macAutocomplete", [
isMenuAppended = true

if inside
$animate.enter menuEl, undefined, element, callback
return $animate.enter(menuEl, undefined, element)
else
$animate.enter menuEl, angular.element(document.body), undefined, callback
return $animate.enter(menuEl, angular.element(document.body))

###
@function
@name reset
@description
Resetting autocomplete
@returns {Promise} Leave animation promise
###
reset = ->
$animate.leave menuEl, ->
$animate.leave(menuEl).then ->
$menuScope.index = 0
$menuScope.items.length = 0

Expand All @@ -210,8 +212,6 @@ angular.module("Mac").directive "macAutocomplete", [

element.unbind "blur", blurHandler

return

###
@function
@name positionMenu
Expand Down Expand Up @@ -254,7 +254,7 @@ angular.module("Mac").directive "macAutocomplete", [
else
{label: item, value: item}

appendMenu positionMenu
appendMenu().then positionMenu

else
reset()
Expand Down

0 comments on commit d6c69cd

Please sign in to comment.