Modern Angular Lazy Loading Guide!

แชร์
ฝัง
  • เผยแพร่เมื่อ 28 ธ.ค. 2024

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

  • @DirtySouth33T
    @DirtySouth33T 4 หลายเดือนก่อน

    awesome video! i implemented this the other day in my app :) glad you did a video on it helped me learn more about it

    • @ZoaibKhan
      @ZoaibKhan  4 หลายเดือนก่อน +1

      Thanks Adam! Lazy loading is an absolute must for any large app or even a medium sized one :)

  • @eneajahollari1203
    @eneajahollari1203 4 หลายเดือนก่อน +3

    In v18.2 there is an automatic migration schematic which can convert all your standalone components in routes to be lazy loaded. You can run it with:
    ng generate @angular/core:route-lazy-loading

    • @ZoaibKhan
      @ZoaibKhan  4 หลายเดือนก่อน +1

      Aah, that will be very helpful! Thanks for the info, Enea

  • @fayazvar3948
    @fayazvar3948 4 หลายเดือนก่อน

    Best video, lot of information, i was not aware about that default keyword.

    • @ZoaibKhan
      @ZoaibKhan  4 หลายเดือนก่อน

      Glad you liked it, Fayaz! Default adds a nice touch :)

  • @shaik-arif-dev
    @shaik-arif-dev 3 หลายเดือนก่อน

    Does lazy loading apply on html too

    • @ZoaibKhan
      @ZoaibKhan  3 หลายเดือนก่อน +1

      Hmm, interesting. I haven't tried that out honestly.

    • @shaik-arif-dev
      @shaik-arif-dev 3 หลายเดือนก่อน

      @@ZoaibKhan I have a doubt like let's take a home component html in that I have a service component html tag but I don't want to see " service heading div " in home component html but okay with seeing in service component can we implement that

  • @daviamerico2268
    @daviamerico2268 2 หลายเดือนก่อน

    how does the user know a component is lazy laoding I mean it takes some time to angular takes js from the server, how can I make an UI which holds during that time?

    • @ZoaibKhan
      @ZoaibKhan  2 หลายเดือนก่อน

      For route based lazy loading, you can use router events for the purpose. For defer block, there is an accompanying loading block and placeholder to show something when those states happen

  • @austinZen8800
    @austinZen8800 4 หลายเดือนก่อน

    well done my friend!

    • @ZoaibKhan
      @ZoaibKhan  4 หลายเดือนก่อน

      Glad you liked it, Austin! How're you keeping up? :)

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

    Hie , can you show us the best implementation for ROLE BASED ACCESS with this particular kind of project, Im sure it would be very helpful. You don't really need to have a backend to show us. I just want to see how we can show certain routes to USER A , and other routes to USER B. I HOPE YOU WILL SEE THIS MESSAGE. THANK YOU SIR.

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

      Hey! I'll add to my list of future videos. It's a good idea, so thanks for that :)
      But a general approach could be to just modify the menu items when the app loads and you get the current logged in role. For that we can keep the menu items in a shared state/service.
      Then for added protection, we can also add route guards to each route checking for the role and denying permission accordingly.

  • @fayazvar3948
    @fayazvar3948 4 หลายเดือนก่อน

    @defer {} it is very interesting.

    • @ZoaibKhan
      @ZoaibKhan  4 หลายเดือนก่อน

      Yes and very powerful! :)