I currently have a method like this:
public addDataset() {
const map = this.generateMap();
this.datasets.push(new Stammdatensatz(map, 0));
this.addButton.nativeElement.scrollIntoView();
}
(I recently discovered Renderer2 and plan to update this code later)
The this.datasets
is being rendered with an ngFor
.
I'm trying to make the site scroll to a specific element when this method is executed, but it's not working as expected.
It seems like the page scrolls before the new dataset is displayed, because when I comment out the two lines above, it scrolls correctly.
Any suggestions on how to fix this issue?