Created
December 9, 2014 16:06
-
-
Save elqsar/0cdfc0a66beb897aac3d to your computer and use it in GitHub Desktop.
Allow user copy paste text without triggering modal open in Angular directive
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function link(scope, element, attr) { | |
var isDragging = false; | |
element.addClass('cursor-pointer'); | |
element.on('mousedown', function(){ | |
element.on('mousemove', function(){ | |
isDragging = true; | |
element.unbind('mousemove'); | |
}); | |
}); | |
element.on('mouseup', function(){ | |
var wasDragging = isDragging; | |
isDragging = false; | |
element.unbind('mousemove'); | |
if(!wasDragging) { | |
$modal.open({ | |
// some logic | |
}).result.then(function (result) { | |
// some logic | |
}); | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment