Angular dependency injection in depth –  Dependency providers (2021)

Angular dependency injection in depth – Dependency providers (2021)

Decoded Frontend

3 года назад

64,977 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@calbofacundo8549
@calbofacundo8549 - 03.07.2023 23:05

literally you are the best man wtf

Ответить
@rs4267
@rs4267 - 14.06.2023 23:04

Thanks I've learned something new 🎉

Ответить
@sorrybuddy4460
@sorrybuddy4460 - 29.12.2022 14:22

Am a beginner its hard to understand 🥲

Ответить
@collinsk8754
@collinsk8754 - 16.12.2022 20:06

Very comprehensive tutorial. Thanks.

Ответить
@nasheedstation260
@nasheedstation260 - 16.08.2022 00:22

Awesome Awesom Awesome Video! Very detailed explanation! Thanks! :)

Ответить
@pavelsokolov4190
@pavelsokolov4190 - 13.07.2022 12:30

Could you please provide more cases where it can be useful except of the experimental mode?

Ответить
@yuriiilnytskyi7698
@yuriiilnytskyi7698 - 05.06.2022 18:23

Dude, you did a really great job. I was aware about these features of Angular DI but also, I was always a bit struggling with deep understanding how does it work under the hood. Now I'm happy that I do :) Thank you man!

Ответить
@dawidniegrebecki2205
@dawidniegrebecki2205 - 28.05.2022 14:03

Such a great video! Coming from the ReactJs background, the dependency injection in angular was totally not understandable for me, but you explained it great! Thank you!

Ответить
@sidharthaverma9609
@sidharthaverma9609 - 04.05.2022 17:41

I can only say thank you so much!!!!!!!

Ответить
@mohammadmokhtari7258
@mohammadmokhtari7258 - 06.04.2022 22:28

👌👌👌

Ответить
@Bukratusi
@Bukratusi - 14.03.2022 00:29

Hatsoff thanks

Ответить
@mahdirezazadeh5076
@mahdirezazadeh5076 - 20.01.2022 12:47

Thank you 🌷
Just use larger font for watching comfortable

Ответить
@cristhianmahecha1707
@cristhianmahecha1707 - 19.01.2022 22:10

I still don't understand why when comparing the two they give false with the useClass, if when giving console.log of both services the same object is obtained, So if the Injector is not supposed to do:
token: LoggerService => Value: new ExperimentalLoggerService(),
and using the private experimentalLogger: ExperimentalLoggerService, the injector does:
token: ExperimentalLoggerService=> Value: new ExperimentalLoggerService().
To then inject the instances when the component is created, they both have the same value but their token is different. It should give true since its value is the same instance, I don't understand 😕

Ответить
@kiaranesperson1293
@kiaranesperson1293 - 07.01.2022 13:32

Здравствуй, Дмитрий. Спасибо за столь отличный материал. Но у меня всё-таки есть недопонимание на счёт useClass/useExisting. В чём разница между обычным провайдом
providers: [SomeService] и через useExisting, например, providers: [{ provide: SomeServiceTwo, useExisting: SomeService}] ? То есть в чём смысл такой подачи сервиса под другим "соусом"? Или в этом нет никакой разницы с точки зрения реализации кода, а всего лишь дело в каких-то паттернах, которые это требуют? Благодарю заранее.

Ответить
@Powerful-Manifestor-
@Powerful-Manifestor- - 07.12.2021 14:51

Awesome explanation!

Ответить
@chrisfelix9065
@chrisfelix9065 - 05.11.2021 19:53

All your videos are better than the Angular Docs

Ответить
@kousheralam8657
@kousheralam8657 - 20.09.2021 16:02

Thank you bro, learned a lot.

Ответить
@UIGems
@UIGems - 28.08.2021 00:11

Great video! Dislikes are from Angular documentation team 😁

Ответить
@rahultej8352
@rahultej8352 - 10.07.2021 19:45

u r the best

Ответить
@SouravDuttaROCKSTAR
@SouravDuttaROCKSTAR - 30.06.2021 17:45

This could be really useful to extend an existing project let's say a codebase developed for one country can be used by other teams to accommodate changes for other countries based on the useFactory concept ... Gonna use this approach, just awesome :D

Ответить
@Sunill_Waugh
@Sunill_Waugh - 13.06.2021 20:33

Please create a video on creating components from configuration file dynamically, thanks

Ответить
@saulo5216
@saulo5216 - 30.04.2021 21:32

That's really good, mate! Saved me from a lot of trouble. Unfortunatelly the Angular documentation does not have as many examples as here, but now I think I have a solid grasp on that topic!

Ответить
@danieldouglas8953
@danieldouglas8953 - 29.04.2021 19:28

Very well explained and it's good to see some real world examples of usage which is something a lot of videos lack.

Ответить
@pakkaodia
@pakkaodia - 15.04.2021 15:04

love from india make tutorial of content projection

Ответить
@umakantlakhawar9092
@umakantlakhawar9092 - 11.04.2021 23:59

Thanks you so much for explaining DI in Angular in simple words. I have watched all your videos on Dependency Injection, very nicely explained . I want to memorize/revise these concepts quickly within few minutes, so could you please provide the source code for the same.

Ответить
@rikisyahputra3805
@rikisyahputra3805 - 02.04.2021 12:37

I don't know why angular DI is so much easier to understand when watching this rather than reading the docs

Ответить
@pritamamre01
@pritamamre01 - 23.03.2021 17:21

Loved content👍, can you make video on monkeypatching ngzone API.
Thanks for awesome video

Ответить
@Don-sl1ny
@Don-sl1ny - 25.02.2021 20:06

Hello
What is the practical use case of useclass provider.

Ответить
@johnadaikalasamy
@johnadaikalasamy - 12.02.2021 13:25

great video, well explained. Thank you very much :)

Ответить
@rajanjoseph4877
@rajanjoseph4877 - 24.01.2021 15:42

Wow! It's really useful to me! Thanks a lot 👍

Ответить
@sanjaygarg3540
@sanjaygarg3540 - 07.01.2021 16:51

Very nice explanation !! Loved it!!

Ответить
@joshblf
@joshblf - 05.01.2021 05:19

It would be cool if you went in depth on tree-shakable providers. You mentioned them a few times but didn't really go into it.

Ответить
@lhargil
@lhargil - 13.12.2020 10:28

This was well-explained. Thank you very much. :)

Ответить
@shivanimehrotra187
@shivanimehrotra187 - 06.11.2020 23:02

Please make a video on Angular Change Detection and Ivy Renderer.

Ответить
@mouradbosli5497
@mouradbosli5497 - 25.10.2020 01:35

Great video man

Ответить
@pedrinhofernandes
@pedrinhofernandes - 13.10.2020 10:22

What would be the best approach when, let's say, you had your application making the API calls on the same base URL but then some module(new section) was introduced that would make calls to a different base API URL?

Ответить
@DecodedFrontend
@DecodedFrontend - 12.10.2020 09:39

Dear developers! Thank you for watching my videos. I hope you will find it useful and I appreciate any feedback from you in comments. Have a productive week 😉

P.s IMPORTANT!!! @Alex Malkevich suggested in comments a very nice approach which allow you to make your useFactory even more flexible. Instead to provide all dependencies in deps: [...] you can provide just Injector and get dependencies via Injector.get(YourServiceHere). Using this approach you should not care any more if your factory function will get new dependency or if dependency order will be changed.
The pseudo-code would look like this:
{
useFactory: (injector: Injector) => injector.get(APP_CONFIG).experimentalEnabled ? ... : ... ,
deps: [Injector]
}
Thanks for suggestion, Alex!

Ответить
@dmitriy5906
@dmitriy5906 - 12.10.2020 08:32

Wow thanks. That was useful especially useFunction part

Ответить