Prevent posible race condition on navurls

stable
Jesús Espino 2015-01-08 10:19:22 +01:00
parent f9bf250b38
commit 3f7776a01d
1 changed files with 12 additions and 12 deletions

View File

@ -105,21 +105,21 @@ NavigationUrlsDirective = ($navurls, $auth, $q, $location) ->
if target.is("a") if target.is("a")
target.attr("href", fullUrl) target.attr("href", fullUrl)
$el.on "click", (event) -> $el.on "click", (event) ->
event.preventDefault() event.preventDefault()
target = $(event.currentTarget) target = $(event.currentTarget)
if target.hasClass('noclick') if target.hasClass('noclick')
return return
fullUrl = target.data("fullUrl") fullUrl = target.data("fullUrl")
switch event.which switch event.which
when 1 when 1
$location.url(fullUrl) $location.url(fullUrl)
$scope.$apply() $scope.$apply()
when 2 when 2
window.open fullUrl window.open fullUrl
$scope.$on "$destroy", -> $scope.$on "$destroy", ->
$el.off() $el.off()