I'm experiencing an issue with Angular 2 where changing from one route to another does not automatically scroll to the top of the new view. I realize that Angular 1 allowed for an autoscroll
property to be added to an HTML element, and others had come up with some simple javascript (such as window.scroll(0, 0)
) to force views to scroll to the top when loaded.
However, I am not sure how to accomplish this with Angular 2. Does anyone know how to achieve this?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…