Це відео не доступне.
Перепрошуємо.
#Angular
Вставка
- Опубліковано 7 лют 2021
- Dependency Injection is a huge and advanced topic in #angular and if you have been following my channel you should know pretty much everything about it. However, there is one remaining thing to cover - View Providers. I would not say it is widely used feature but it is definitely worth to figure out what gives us View Providers and when it could be useful. Please leave your feedbacks in comments and let's get started to explore further Angular DI. Enjoy!
📣 Become a Pro in Angular Material Theming (Advanced Workshop) 📣
bit.ly/angular...
✅ Use 10%-off coupon code: UA-cam_DISCOUNT (Only 2 coupons left)
📣 Blazing fast GraphQL Backend just in 1 Day with Hasura Engine 📣
bit.ly/complet...
✅ 20%-off coupon code: HASURA-EASY-START
⚠️ New to Angular?
Get the best onboarding Angular course which I used for easy start with Angular:
bit.ly/angular-...
------------------ See my another videos about Angular ------------------
✅ Check out my video "My TOP 5 Angular Interview Questions"
• TOP 5 Angular Intervie...
✅ Check out my videos about Angular Material Library:
• Angular Material
✅ Check out my videos about Angular CDK:
• Angular Material CDK
#angulartutorial #webdevelopment #dependencyinjection
Very good explanation, and with examples makes it easier to understand where this could be useful. Thanks!
Thanks, Pedro :)
Fantastic content, keep on going producing video about reusability and angular, very greatfull for this video!
Amazing content. Thank you!
Amazing content, such a gem on youtube, how can I miss your channel all this time. Could you make a video about how to get better after familiar with angular basic ?
As usual superb explanation..
please make a video on the angular routing guards.....
Good point, thanks! There are a lot of interesting things to discuss there :)
I can't understand the usefull case for that.
Why we can't just simply use required service (GalleryCustomLoggerService) inside GallerySlideComponent (inject in constructor)?
@DecodedFrontend can you please respond to this question if possible.
Men soo good the explanation!!!. I basically an ng pro now :)
😄 great to hear that and thanks for feedback!
Excellent explanation,please make video on previous next value of textbox,how to maintain in angular internal storage mechanism
Waaaw simply amazing👌👌👌👌
Спасибо, наконец то смог разобраться.
Отлично 👍🏻 Рад слышать, что видео оказалось не бесполезным 😊
skipself would do exactly same thing as view providers does right ?
Excellent video 🏅
Thanks 🙏🏻
Thanks, best wishes ✨❄️🔥🙏
Amazing content!
In short does it means view providers is not available for projected content? They are only limited to current component or current component children?
Hi,
Yes, exactly! you can say it like this :)
Great, decoded
How can you use the new service in the gallery and in the slide ?, now only is used in the slide component ?
Great Content! But what would happen if the slides' components are declared inside the gallery component's template. Will the service will be available also to them?
Yes. viewProviders array makes services avaialble only for current component and current component children.
Pretty cool!! but what if i want to user different services instances on the app-gallery-slide component. Thanks for theses videos theyre super usefull
Hi! Do you mean that every app-gallery-slide has its own insurance of the service?
@@DecodedFrontend Yeah, I mean that every app-gallery-slide has its own instance of the logger interface.
@@Yumo3000 then you have to provide a service in app-gallery-slide component (in @Component annotation) instead of app-gallery component as it is now. If you do so, then angular create a separate instance of service for every slide component
@@DecodedFrontendYeah, that's fine, but I mean, how can I assign the service instance that is using the child, from parent component?
If you want to access the children’s service instance from parent Try to use: @ViewChild(GallerySlideComponent) slide: GallerySlideComponent; in parent (GalleryComponent) and then in “slide” you will have an instance of Slide Component and you can access there the service of the slide. Just don’t forget to change access modifier from “private” to “public” in a constructor of the slide component.
Hello Dmytro! First of all, your content is great and your explainations are very clear. However i tried to check it in Angular 15 and standalone components and it looks like the bevahior is different. Could you please check this out? Is this some kind of bug with standalone components?
Hi! Much appreciate your feedback :) Could you please describe in a bit more detail what exactly is different when it comes to Standalone components? or maybe you have some reproducible examples in Stackblitz?
Never mind... :) i must have missed something because now it works as expected
I like ur subscribe 😄
What if we remove providers from the component where we are using gallery with gallery slides. Does "viewProviders" make providing own service optional? So what I mean, it's like es6 default argument value, if we not provide this argument, default value will be used in the function
Couldn't spot the difference it made. Can anyone help?
So, can we conclude that if you have an ng-content in the template, you should use viewProviders ?
Not always. Only if you want to hide some services from projected content.