Video details

Angular ViewChild Decorator Trick (advanced, #shorts, #webdevelopment, #angular )


Thanks for watching! I would higly appreciate your feedback and comments. Subscribe to my channel and check out my courses.
📣 In-Depth Angular Material Theming Course
✅ Use 25%-off coupon: YOUTUBE_DISCOUNT


Hi angular developers when you need to get a reference to some component directive or service which is declared in some components view, you usually use a view child decorator and as a selector you provide a class name that you are going to resolve. However, on this node usually resides not the only directive, and sometimes you have to keep a selector the same, but the reference should point out to completely different thing element. As example. In this case you you can provide additional config to the view child and here you can declare what you actually want to read. In my case, it could be a reference to the Dom element. Subscribe to my YouTube channel decoded front end if you want to learn more advanced and glare tricks.