Angular Inject Function - Better Than Constructor

Поділитися
Вставка
  • Опубліковано 17 жов 2024

КОМЕНТАРІ • 50

  • @MonsterlessonsAcademy
    @MonsterlessonsAcademy  Місяць тому +1

    WATCH NEXT: Angular Interview Questions and Answers - Dominate Your Next Interview - ua-cam.com/video/5A_YKlVWMPo/v-deo.htmlsi=2DCn7yspEAAJ2H6l

  • @hamza201183
    @hamza201183 Рік тому +8

    Wow there are so many things to learn in Angular...

  • @e-jarod4110
    @e-jarod4110 Рік тому +3

    Insanely good explanation!
    I hesitated dropping constructors injection because I didn't feel the real need to move to inject()
    But I didn't know it is possible to export destroy$ for example in a simple reusable function

  • @prasoon2510
    @prasoon2510 2 місяці тому

    You are awesome.. you explain in very easy and practical manner.
    Thank you

  • @ytamb01
    @ytamb01 Рік тому +8

    That was really good - both creating re-usable code outside your component and a much cleaner way of extending components. Thanks very much.

  • @tomozi1
    @tomozi1 Рік тому +2

    Отличная подача! Как всегда материал на высоте

  • @fadil2671
    @fadil2671 Рік тому +2

    nice video, now i need to refactor all my codes 😁😁

  • @advance5189
    @advance5189 5 місяців тому

    Awesome explanation and moreover, your English is so clear that I wanna listen to you and listen.. Keep going!

  • @hamza201183
    @hamza201183 Рік тому +1

    Many thanks, great video as always.

  • @ythalorossy
    @ythalorossy 5 місяців тому

    Amazing explanation.

  • @banafish
    @banafish Рік тому

    Great Video! What font and theme are you using here? Very readable

  • @visufactmanufacturing7712
    @visufactmanufacturing7712 Рік тому

    It's a very good video, thank you! I wonder if it would be better to name functions that can only be used in an injection context in a specific way, in order to differentiate them from other functions. For example I would prefer to call them "injectPageParam()" or "injectOnDestroy()".

  • @Brendan2Alexander
    @Brendan2Alexander Рік тому

    Awesomely helpful! Thank u

  • @MrGCastilhos
    @MrGCastilhos Рік тому

    Amazing content, thanks a lot

  • @thirukumaran6034
    @thirukumaran6034 Рік тому

    Your courses are short and sweet ❤. Can you please create a new session for unit testing inject() function

    • @MonsterlessonsAcademy
      @MonsterlessonsAcademy  Рік тому

      I added it to the list of future videos. Thank you for the idea!

    • @JonatanPetersson
      @JonatanPetersson Рік тому

      @@MonsterlessonsAcademy Would really like this too. Especially where you've extracted them into functions

  • @mjpanebianco8162
    @mjpanebianco8162 Рік тому

    Does this method of injection protect against creating multiple instances of a service you intend to be a singleton?

    • @MonsterlessonsAcademy
      @MonsterlessonsAcademy  Рік тому

      It doesn't protect against anything. It is just the same like defining it in the constructor

  • @DavidKooffreh
    @DavidKooffreh 4 місяці тому

    For the final part what is the advantage of using that over ngOndestroy

    • @MonsterlessonsAcademy
      @MonsterlessonsAcademy  4 місяці тому

      You make a reusable function which should not be duplicated in every single component with ngOnDestroy

    • @DavidKooffreh
      @DavidKooffreh 4 місяці тому

      @MonsterlessonsAcademy Thanks that was very useful information

  • @mohammedsalah932
    @mohammedsalah932 Рік тому

    Good video ! do you have a video about OnChange and how can i use it between parent and child component so i dont have to reload the page to view changes ?

  • @wiliam334
    @wiliam334 Рік тому

    How do we mock them in the tests now? Ta

  • @theWorldOfIss
    @theWorldOfIss 17 днів тому +1

    After 1 year I am knowing it😅

  • @alexmatveev7730
    @alexmatveev7730 Рік тому

    For destroy/unsubscribe we can use takeUntilDestroyed
    Function. Yes, maybe it's still in dev mode

  • @4444-c4s
    @4444-c4s Рік тому +1

    Don't know why Angular is bringing so many things at once..Really hard to get clear idea in Mind What to use and When to use. Confusion hi Confusion hai😅😅

  • @val-do
    @val-do Рік тому

    you're hidden 💎 🎉

  • @emmanuelU17
    @emmanuelU17 Рік тому

    Pretty cool but I am a big fan of construction injection.

  • @MuhamedHassan-ry5fs
    @MuhamedHassan-ry5fs 7 місяців тому

    can you suggest me road map to learn advanced angular if you can

    • @MonsterlessonsAcademy
      @MonsterlessonsAcademy  7 місяців тому

      Just take a real project and do it from start to the end. Like we are doing in this course
      ua-cam.com/video/vcfZ0EQpYTA/v-deo.htmlsi=8kMu3zbCa0K_1hxP