angularJS - getting x & y positions from mouseclick in div
You need to change event.x
to event.offsetX
and event.y
to event.offsetY
You didn't add the template definition but I'll add it just in case:
<div ng-click="addOnClick($event)"></div>
In html file, use:
<div (click)="test($event)"></div>
And in the function in the ts file::
function test(e){
console.log(e.clientX);
console.log(e.clientY);
}