Scrolling to an element after dom loading


I’m trying to use scrollIntoView on an element when the view loads but i cant seem to get it to work. Currently i’ve tried using it in constructor, ngOnInit, ngAfterViewInit and none of them seem te move a pixel. It looks to me like an timing issue. (When i request the offsetTop value its way to low (only 260) whilst its about the 7 image on the page all coming in at 244px height).

Any one have any experience with scrolling to an position (preferably before the view is shown so the user doesn’t notice it).

with best regards,


Putting a button down and pressing it executing the same code does work