Angular Scroll Position Restoration

แชร์
ฝัง
  • เผยแพร่เมื่อ 3 ม.ค. 2025

ความคิดเห็น • 29

  • @sudiptomukherjee644
    @sudiptomukherjee644 ปีที่แล้ว +4

    Excellent and informative video. It is a needed feature in most application. Thank you :)

  • @VladyslavHaidar
    @VladyslavHaidar ปีที่แล้ว +4

    Sir, please, don't disappear, we like your content so much, keep going on it!

  • @giorgoskontis7185
    @giorgoskontis7185 ปีที่แล้ว +2

    Thank you for the video man!

  • @zzzbyyy
    @zzzbyyy 2 วันที่ผ่านมา

    This is exactly what I was looked for .... I have same problem with scrolling in my app. I feel like everything is so complicated in Angular LOL

    • @CodeShotsWithProfanis
      @CodeShotsWithProfanis  2 วันที่ผ่านมา

      Out of curiosity, how does a restore scrolling implementation looks like to other frameworks?

    • @zzzbyyy
      @zzzbyyy วันที่ผ่านมา

      @@CodeShotsWithProfanis Well that's a good question. I have never done this in other frameworks that's why probably thought it's gonna be easy. In reality it's tricky ...

    • @zzzbyyy
      @zzzbyyy วันที่ผ่านมา

      is this solution will work when I use this.router.navigate() ?

    • @CodeShotsWithProfanis
      @CodeShotsWithProfanis  วันที่ผ่านมา +1

      ​@@zzzbyyy yes indeed. It's relatively straight forward with static data, but tricky with dynamic data. I am not sure either how the implementation looks like in other frameworks, but I like that we do not have to manually track the scrolling position. We only need to fetch and use it.

  • @veeramanikantapinnana423
    @veeramanikantapinnana423 ปีที่แล้ว +1

    Hi
    Can I know which vscode extensions you are using

  • @ralph8529
    @ralph8529 ปีที่แล้ว

    Nice example of practical feature which for example ecommerce shops often needs, when back to list of products. Personally I create a public method for emit a value by BehaviourSubject and keep my BehaviourSubject property private. But this is some individual preferences I think.

  • @rythmrana1987
    @rythmrana1987 3 หลายเดือนก่อน

    which version of angular is this

    • @CodeShotsWithProfanis
      @CodeShotsWithProfanis  3 หลายเดือนก่อน

      I am doing that with Angular 18 but it's also compatible with older versions.

  • @swapnasaritnayak2569
    @swapnasaritnayak2569 ปีที่แล้ว

    What if we assign the route pipe to an observable and use it in tap operator inside the API call pipe ?

  • @ZeR0ByTe
    @ZeR0ByTe ปีที่แล้ว

    Thanks!
    And what happen if you are using Infinite Scroll? Will works too?
    Thanks!

    • @CodeShotsWithProfanis
      @CodeShotsWithProfanis  ปีที่แล้ว

      That's an interesting question.
      I would approach that by tweaking the "decision point".
      Meaning: When you have an infinite scroll you can keep the state of the current page on the query params (e.g. ?page=2).
      When you navigate back to the page you are taking under consideration the page query param, you are firing the HTTP calls and I would expect the HTTP Calls to have the current page on the response.
      The decistion point would be HTTP Response#Page_Property===Page_Query_Param

  • @anuragsing039
    @anuragsing039 8 หลายเดือนก่อน

    HI fanis , please can you provide a demo code for this video against.

  • @tomazmajerhold8413
    @tomazmajerhold8413 ปีที่แล้ว

    it looks like position$ is not emitting from router

  • @tomazmajerhold8413
    @tomazmajerhold8413 ปีที่แล้ว

    RestoreScrollPositionDirective:ngAfterViewInit I see in console that is called at correct time but is not scroll to the correct position. AutoScrollService::init position has no next emited

  • @rythmrana1987
    @rythmrana1987 3 หลายเดือนก่อน

    perfect

  • @tomazmajerhold8413
    @tomazmajerhold8413 ปีที่แล้ว

    My mistake I forget withInMemoryScrolling

  • @santiagobruno_t1581
    @santiagobruno_t1581 6 หลายเดือนก่อน +1

    thanks!!!!

  • @iamtrinhchau
    @iamtrinhchau 11 หลายเดือนก่อน

    🎉 awesome

  • @mahdiandalib186
    @mahdiandalib186 ปีที่แล้ว

    thx man

    • @mahdiandalib186
      @mahdiandalib186 ปีที่แล้ว

      plz create full web with admin panel using angular

  • @aram5642
    @aram5642 ปีที่แล้ว

    What you did is kind of replica of bfcache and pageshow event for SPA :)