You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
554 B
CoffeeScript
20 lines
554 B
CoffeeScript
module.exports = (module) ->
|
|
module.directive "viewLink", ->
|
|
return {
|
|
restrict: "A"
|
|
link: (scope, element, attributes) ->
|
|
element.on "click", (event) ->
|
|
scope.$apply ->
|
|
findViewScope = (scope) ->
|
|
while true
|
|
if scope.hasOwnProperty("_isWindowViewScope") and scope._isWindowViewScope
|
|
return scope
|
|
if not scope.$parent?
|
|
return undefined
|
|
scope = scope.$parent
|
|
|
|
viewScope = findViewScope(scope)
|
|
viewScope._currentRoute = attributes.viewLink
|
|
event.preventDefault()
|
|
}
|