Adding confirm-link directive

This commit is contained in:
Rob Harrington
2015-11-12 09:49:36 +11:00
parent b5aaf36bd2
commit 5a7cac652c
2 changed files with 10 additions and 1 deletions

View File

@@ -0,0 +1,9 @@
# Used on a link to prevent link clicks unless a callback returns true (probably asking for user confirmation)
angular.module("admin.lineItems").directive "confirmLinkClick", ->
restrict: "A"
scope:
confirmLinkClick: "&"
link: (scope, element, attrs) ->
element.bind "click", (event) ->
unless scope.confirmLinkClick()
event.preventDefault()