I have a "popup" that displays data retrieved from a database on mousemove
and appears at the mouse location. It looks like this:
<div (mousemove)="onMouseMove($event)></div>
onMouseMove(event: MouseEvent) {
this.xCoord = event.x
this.yCoord = event.y
}
<div [style.left.px]="xCoord" [style.top.px]="yCoord" class="popup">
...
</div>
Because the dimensions of the popup are dynamic, depending on its content, I need to retrieve the dimensions in order for the popup to be placed properly (above the target and centered horizontally). Is it possible in Angular 2 to get style properties from an element without, for example, a mouse event? Ideally, the dimensions are assigned to a variable when the popup appears.