arrow_back Back to Notebook
angular
angular
January 10, 2019

Scroll to the the top of the page automatically in AngularJS

You can scroll to the top of the page automatically by injecting Window and using the function scroll(x,y).

Window docs

Scroll to top code example

constructor(
        @Inject('Window') window: Window
) {
    window.scroll(0, 0);
}

Thanks for reading!

John Wiseman

Full-Stack Software Engineer building scalable digital solutions. specializing in modern web technologies and mission-critical systems.

© 2026 Wiseman Systems Pty. Ltd.

Navigation

Start a Conversation

Ready to discuss your next project? Let's build something extraordinary together.

Get in Touch