Resolver Guard in Angular Router (2021)

Поделиться
HTML-код
  • Опубликовано: 8 сен 2024

Комментарии • 64

  • @DecodedFrontend
    @DecodedFrontend  3 года назад +6

    Please use the time codes in the video description, leave your feedback, and check out my Angular Courses - courses.decodedfrontend.io
    UPDATE: In the video, I forgot to mention that when the error happens in the resolver observable, the NavigationCancel event is fired instead of ResolveEnd which might cause the loading animation to be stuck. It could be solved by extending the filter operator in _hideLoaderEvents$ by filter((e) => e instanceof ResolveEnd || e instanceof NavigationCancel).

  • @davicampos802
    @davicampos802 3 года назад +10

    This channel is amazing , there is no word , every video you post about angular motivates me to learn

    • @DecodedFrontend
      @DecodedFrontend  3 года назад

      Happy to hear that! and your motivation motivates me to make more videos ;)

    • @dragorwyin9809
      @dragorwyin9809 3 года назад

      @@DecodedFrontend Yeah, that's true! Don't stop to upload such a great content. Even your sense of humor and faults are great :D Keeping those movies alive!

  • @yuwenchiou3911
    @yuwenchiou3911 5 месяцев назад

    best angular tutorial i've seen so far, very practical, clear and useful.

  • @TheNsn666
    @TheNsn666 3 года назад +3

    you should make unit test deep dive that would be awesome

  • @SunnyVakil
    @SunnyVakil 3 года назад +3

    Really I got some more insight every time when I’m watching your videos, Can you make something for global errors handling in Angular. Last but not least Thank you so much ! for amazing and informative videos.

  • @janardhanangurusamy1658
    @janardhanangurusamy1658 3 года назад +3

    Really amazing video to understand all the angular concepts more clearly 👏

  • @pedrofernandes2005
    @pedrofernandes2005 3 года назад

    The routing resolve events is really useful, didn't know we have that.

  • @isasunasra9910
    @isasunasra9910 2 года назад

    Awesome, just what I was looking for months, TYSM

  • @akshaymhatre9123
    @akshaymhatre9123 3 года назад +4

    I get to learn new things with every video that you make. Great video as always.
    One suggestion - While uploading project on Github, can you create 2 branches, one with starter code and other with the Final solution?

    • @AlphaFrog1021
      @AlphaFrog1021 2 года назад

      that's really good idea I hope he sees it

    • @DecodedFrontend
      @DecodedFrontend  2 года назад +1

      I see it :) Thanks for suggestion, I will keep in mind it next time!

  • @krisnarusdiono1304
    @krisnarusdiono1304 3 года назад +2

    yeay, a course that i was looking for

  • @craigiswayne
    @craigiswayne 2 года назад +3

    Great content, loved the techniques you used, especially merging of the observable streams, super useful.
    What I would have liked to have seen is the error scenario handling, to see what happens

  • @aleksandrm3466
    @aleksandrm3466 3 года назад +1

    This is super as usual, thanks a lot. It would be cool to see some video from you regarding RxJS operators that you often use and best places to use. Thanks in advance:)

  • @mrthefankyy
    @mrthefankyy 3 года назад +1

    Guy, make all for being as a "Google Angular Developer Expert". Good luck!

    • @DecodedFrontend
      @DecodedFrontend  3 года назад +2

      Hi Dmitry! Believe or not, but this morning I officially became a Google Developer Expert in Angular 😄

  • @gonzaloetchegaray5998
    @gonzaloetchegaray5998 3 года назад

    Nice video! The content of this channel is amazing. This kind of content is hard to find.

  • @rs4267
    @rs4267 5 месяцев назад

    An other banger thanks 🎉

  • @mktrann
    @mktrann Год назад

    Thank you so much ❤!

  • @hadirahmani7943
    @hadirahmani7943 2 года назад

    Thank you very much 😎😎😎

  • @carlosiglesias8354
    @carlosiglesias8354 2 года назад

    thanks again! I just copied your code into my project!😀

  • @santoshraju9230
    @santoshraju9230 3 года назад

    Excellent!! Nice explanation. Thanks

  • @sweetsamikshya
    @sweetsamikshya 2 года назад

    I am learning so much from you man :)

  • @amar-iby
    @amar-iby 2 года назад

    thank you for this amazing video !

  • @Panossa
    @Panossa 8 месяцев назад +1

    I feel like 13:26 could be done much easier, in one Observable instead of three. Something along the lines of:
    export class AppComponent implements OnInit {
    isLoading$!: Observable;
    constructor(private router: Router) {}
    ngOnInit(): void {
    this.isLoading$ = this.router.events.pipe(
    filter((e) => e instanceof ResolveStart || e instanceof ResolveEnd),
    map((e) => e instanceof ResolveStart)
    );
    }
    }
    When the event is a start event, it'll get mapped to true; else to false. No need to merge Observables or even have them on a class-level as variables. Or am I missing something?

  • @andresmauriciofajardoolaya2721
    @andresmauriciofajardoolaya2721 3 года назад

    excellent video, thanks for spend your time do it

  • @kelvinticllahuanacohuachac9562
    @kelvinticllahuanacohuachac9562 3 года назад

    Amazing bro, nice explanation. thanks a lot.

  • @sakarsr
    @sakarsr 3 года назад +2

    Thank you for this video, please let me know what extension your using to generate the resolver in vs code?

    • @DecodedFrontend
      @DecodedFrontend  3 года назад +1

      Hi! Thanks for a feedback. It called NX Console

    • @sakarsr
      @sakarsr 3 года назад

      @@DecodedFrontend thank you

  • @biniyammoges9040
    @biniyammoges9040 2 года назад

    it helped me! thanks bro

  • @craigiswayne
    @craigiswayne 2 года назад

    love your hair! content is great as well, thanks

  • @wiliam334
    @wiliam334 Год назад

    Thank you for it.
    But can u show us how to resolve the user data on page refresh once the user is on the user details page.
    In the example above the users url was harcoded on the user service. But how would u solve if the url was on the parent component?
    Thank you😊

  • @santhoshreddy7555
    @santhoshreddy7555 2 года назад

    Great video thank you. Can we use mutliple 's and can we display two angular applications in single page? pls tell me

  • @nanasarathi
    @nanasarathi 2 года назад

    Very informative 👍

  • @b4m5
    @b4m5 3 года назад +1

    Thanks a lot, bro 🤟

  • @carlosiglesias8354
    @carlosiglesias8354 3 года назад +1

    Great resource

  • @user-hd8dm5ur3i
    @user-hd8dm5ur3i Год назад

    Great video! What if we navigate to specific route second time, but don't want to see this 'progress-bar event' again. Can we cache our data with this Resolver and is it make sense?

  • @wiliamferraciolli5380
    @wiliamferraciolli5380 Год назад

    Hi thanks for the tutorial, but can you make one where the resolver depends on another resolver?
    Eg in this very same scenario where the user deep link onto a single user.
    But the difference would be that instead of hard coding the Users link, this would be provided by another resolver
    So getUsers need a resolver to get the list of users and its link (profile) then getUser will need to get the link from the usersResolver to them append the id to it
    thanks

  • @TimmyPl
    @TimmyPl Год назад

    Hi, what if the case if I want refresh resolved data ? I mean, in „shared service” way I will create something like refreshData subject and switchMap with it. How can I achieve this kind of behaviour in resolver ? Should I refresh entire page to get routing kick in and refresh the data ?

  • @bigk9000
    @bigk9000 2 года назад

    I have that same extension that displays the import cost; however, whenever I import anything from `rxjs` (and not `rxjs/internal/Observable` or the like), mine reads out as "144.1k (gzipped: 28.6k)" while yours reads as "8.8k (gzipped: 2.8k)".
    Is there a certain setting I need to configure with the extension? Or is there something you have established with your app's configurations/settings?
    Like I alluded to previously with `rxjs/internal/Observable`, I saw this video on boosting an Angular app's performance (that was narrated and assumingly written by Jeff Delaney/Fireship), and he recommended to start importing from `rxjs/internal/Observable` directly. I also know there are the "static imports" that work like `import 'rxjs/Observable/add/map` or the like. I'm never sure which one I should use for which particular use case. Is there a diagram, a chart, or a question diagram/tree I can use for a reference?
    Apologies for the word vomit, but this has been an issue I've been trying to wrap my head around for a while and noticing the remarkably small import size you were getting for RxJS modules was incredibly perplexing for me.
    Any assistance is much appreciated!

  • @ShashankGram
    @ShashankGram 2 года назад

    Thank you

  • @dennis87ist
    @dennis87ist 2 года назад +1

    It's admitted to inject some Store into the resolvers and dispatch action from them? Or the best practice is to inject the store only in parent component and dispatch all the actions needed to load it and all it's children?

    • @DecodedFrontend
      @DecodedFrontend  2 года назад

      I personally do not see any problems with that. Of course, it depends a lot on a concrete use-case but if you need, for instance, to dispatch some action or resolve data which depends on data from the Store and you need to do it right before the component for the route will be activated, then I do not see any other option as to inject the store in your resolver and use it there.

  • @khumozin
    @khumozin 3 года назад +1

    Nice video, however this does not work on Angular 12, please assist.
    Thanks

    • @khumozin
      @khumozin 3 года назад

      Actually, I'm using a resolver with a guard

    • @DecodedFrontend
      @DecodedFrontend  3 года назад

      Hi Khumo,
      Thanks for your feedback. Actually, it works with Angular 12.x, you probably should look for the issue on your end.

  • @minnininja4777
    @minnininja4777 2 года назад

    Its great video, thanks for it. Also can you please tell me the extension you are using to show the imported module size in kb ?.
    Thanks in Advance.

    • @DecodedFrontend
      @DecodedFrontend  2 года назад +1

      Hi! It is this vs code extension marketplace.visualstudio.com/items?itemName=wix.vscode-import-cost

    • @minnininja4777
      @minnininja4777 2 года назад

      @@DecodedFrontend thanks bro

  • @dmrshack
    @dmrshack 2 года назад +2

    you are the good teacher, but sometimes we didn't understand because you start video and you are already create project and configure everything, that lost us...

  • @covertgravy
    @covertgravy 3 года назад

    will something like this resolve?
    return {
    listA: Observable,
    listB: Observable
    ...
    }

  • @ariyoayodejiifeoluwa65
    @ariyoayodejiifeoluwa65 Год назад

    please what's the name of the extension you used to generate the resolver