Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scrolling issue #499

Open
Amitshaale opened this issue Nov 20, 2019 · 8 comments
Open

Scrolling issue #499

Amitshaale opened this issue Nov 20, 2019 · 8 comments

Comments

@Amitshaale
Copy link

Amitshaale commented Nov 20, 2019

Hi,

On changing route page is showing from bottom it should be from start(Top).

I have tried for fix but still I it's not fixed. can you help please?

my code is here in app.routing.module.ts

RouterModule.forRoot(routes, {
      useHash: false,
      preloadingStrategy: PreloadAllModules,
      initialNavigation: 'enabled',
      scrollPositionRestoration: 'enabled'
    })
@tomastrajan
Copy link
Owner

Hi @Amitshaale !

Did you try scrollPositionRestoration: 'top'

https://angular.io/api/router/ExtraOptions

@Amitshaale
Copy link
Author

Hi @tomastrajan

I have tried this solution but it's not working scrollPositionRestoration: 'top'

@tomastrajan
Copy link
Owner

@Amitshaale which browser/ os ?

@Amitshaale
Copy link
Author

@tomastrajan Chrome in mac os.

I think with module routing it's not working.

@Amitshaale
Copy link
Author

@tomastrajan any solution on this issue?

@Amitshaale
Copy link
Author

Amitshaale commented Nov 23, 2019

I have tried with this code but still it's not working...

const routerOptions: ExtraOptions = { useHash: false, anchorScrolling: 'enabled', scrollPositionRestoration: 'enabled', scrollOffset: [0, 0] // [x, y] }

@Amitshaale
Copy link
Author

@tomastrajan issue still not fixed. how to fix?

@varunahuja555
Copy link

@Amitshaale

Try this. It's working.
const elmnt = document.getElementById(id); elmnt.scrollIntoView({behavior: 'smooth'});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants