EP 10.6 - Angular / Dependency Injection & Providers /Providers and viewProviders
HTML-код
- Опубликовано: 5 сен 2024
- 📚 Read the book 👉 go.asim.dev/an...
🔥 Level up your JavaScript 👉 go.asim.dev/advjs
🌿 If you find my videos useful please consider planting a tree for me 👉 go.asim.dev/trees
🎥 Watch the full playlist 👉 go.asim.dev/an...
The best place to view the code associated with this course is in the online book (go.asim.dev/an...) via the book if a lecture has code associated with it, it then also has a link to a stackblitz instance so you can run and edit the code sample online.
We can configure the DI framework in Angular in three main ways.
We can configure a provider on the NgModule, on a component or directives providers property and on a components viewProviders property.
Deciding where to configure your provider and understanding the difference is the key to understanding how to architect an Angular application.
If we want an instance of a dependency to be shared globally and share state across the application we configure it on the NgModule.
If we want a separate instance of a dependency to be shared across each instance of a component and it’s children we configure it on the components providers property.
If we want a separate instance of a dependency to be shared across each instance of a component and only it’s view children we configure it on the components viewProviders property.
Finally found a video which is not only introduced how to use DI but also showed how it works
Best best teacher in angular❤️
The bestest (if there is any word beyond best) video series on angular that I have ever gone through... thanks a lot Sir !!!!
I wish some day this teacher would share his method of self learning and how he decodes the essence of the concepts, I mean his scientific approach on investigating the real picture and meaning behind framework. So injection is a method of declaring your own types of variables and the way of injection is the scope/context of visibility of those variables
And yes, of course - a huge thanks on providing this course, invaluable, a real thing
Great Tutorial, After watching your tutorial only I understand DI, You are a great teacher, Thank God I found your channel.... Thank you very much...
This is a masterpiece on Providers. Simple and straightforward
God, this guy is a real teacher!
Best explanation ever, Thank you so much!
Thanks so much - watched it half away across the globe. Well explained complete with animations.
The only place where I totally understood the concept of Providers and in turn Injectors and also differentiated the DI in Angular from .Net Core since I'd relate to .Net Core to understand it. Awesome explanation, awesome example and really awesome knowledge all round.
wooow
It was really impressive
Thank you for sharing this fantastic video about an important DI topic in angular.
this made the concept of view providers so much clear ! Thankyou !
Great Explanation...
Great info. Thanks
Amazing way to explain it thanks for removing the ambiguity on top of this subject.
Great Tutorial!!!
Great session! On stop to learn DI. Many thanks.
Thank you very much! I feel like I finally understand providers
single word to say that awesome..
Really solid!! Thank you
Thanks for your video, I finally understood how does it work
Great Job, Thank you for you tutorial
Very nicely explained, thank you!!!!
Great Explanation.
👍 Extremely clear! Thnx.
Great explanation, many thanks for your work, Asim. Will definitely be buying your courses on Udemy.
What you mentioned in 12:52 is correct provided the parent component doesn’t have a providers property for the same service.
In other words, if I have both viewProviders: [SimpleService], providers:[SimpleService] set in parent component then the projected ng-content seem to work like before. Although, I couldn’t find an explanation to this behaviour in angular.io.
That was Great thank you !
the only thing that I needed to know is that providers inject the same Instance (singleton)
Awesome :)
great video thanks! how'd you make the diagrams? very nice with the arrows animating in, is it a slide show?
is this code still working!? To me it looks it doesn't work, maybe because the video is four years old now
Is there an EP 10.5? : )
Yes there is, check out the full playlist: ruclips.net/video/QZbih91PH44/видео.html