Created
October 24, 2016 12:52
-
-
Save zmts/772104c1250872a9e812aab39748c5ed to your computer and use it in GitHub Desktop.
Get coordinates in AngularJS
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
// in DOM | |
<div class="test" ng-click="vm.getСoordinates($event)"> | |
... some content ... | |
</div> | |
// in controller | |
function getСoordinates(e) { | |
vm.x = e.clientX; | |
vm.y = e.clientY; | |
console.log(vm.x + ' ' + ' ' + vm.y) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment