Does anybody know the proper implementation of scrolling to anchor. This approach doesn't work: Angular2 scroll to element that has *ngIf
Here is the template that has references to other components:
<app-app1 id="id1"></app-app1>
<app-app2 id="id2"></app-app2>
<app-app3 id="id3" *ngIf="test"></app-app3>
By clicking on a button I'd like to scroll to the appropriate section:
let elm = document.querySelector("#id1");
if (elm)
elm.scrollIntoView();
The scrollIntoView() is executed but it scroll to wrong place (like to the middle of the section) and doesn't work for app-app3 at all.