


![Безумие обратных вызовов в javascript [JS]](https://i.imgur.com/WsjO6zJb.png)


document.querySelector('p').offsetTop
Это извлекает его верхнюю позицию относительно своего родителя и offsetLeft относительно левого угла.
Пожалуйста, попробуй:
В component.html определите ссылку на тег html:
<p #position>I want to go back here</p>
В component.ts:
@ViewChild('position') HoldPosition: ElementRef;
clickFunction() {
console.info(this.HoldPosition.nativeElement.offsetTop);
console.info(this.HoldPosition.nativeElement.offsetLeft);
}
`` ''