#31 ViewChild() in Angular | Angular Component & Directives | A Complete Angular Course
HTML-код
- Опубликовано: 18 ноя 2024
- In this lecture you will learn about @ViewChild() in Angular and how to use it on DOM elements & Components. The @ViewChild() is a decorator which allows us to access a reference to a DOM element, a component or a directive in the component class.
ASP.NET Core GitHub Repo: github.com/man...
NODE JS Course GitHub Repo: github.com/man...
ANGULAR 16 Course GitHub Repo: github.com/man...
Thanks for uploading the series. I have started to learn angular from the beginning. I hope your series will benifit me.
I have 10 years of experience in UI development. It is an Awesome tutorial for all thanks
welcome back 🙏 ❤
Awesome tutorial 🔥🔥🔥
Sir please complete the node js course
Just one thing you were wrong about is that "static" property is by default "false" not true. Other than that you did a good job.
10:11 for click to view product starts
i am completed the given tasks
Thank you❤
One of things that is cracking me up is get the shoes to span across the page, my shoes are listed one under another, I have tried in lot of different places but I cannot find the right spot to include it. Any help will be gratefully accepted.
I used bootstrap and created a div with class="container flex-wrap". In this case, each product will wrap around and create a grid layout.
A very good course so far. Unfortunately, this is the first chapter where the use case is not really clear. The problems can be solved much easier with pure data binding and ViewChild seems slightly exaggerated here.
I would have liked to see more detail on when to use ViewChild versus data binding and when not. Otherwise it was very understandable.
I share the same opinion as you, and I took the same approach.
Do you have any other possible use cases where ViewChild can be essential?
I think that the ViewChild will be used when you want to have communication between non related components
Is this complete course for angular?
When will do typescript video
how do we know when to use ViewChild to pass data from child to parent and when to use the old way using @output ? and when to use template refernece or ViewChild
code for size :
{{size}}
please sir upload the video contineuosly
hi sir, can you please share a project file upto this lecture, to continue the flow with you
15:00 > ok, so you use the component's class name, not the selector, right? Cause the selector is usually different by default.
Is it correct to say that this @ViewChild() is an alternative to @Output(), cause I think you can achieve the same using just a reference variable for product-list and an @Input() in the product-details. I do understando it seems more invasive than input and output, cause with viewChild you could easily overwrite any variable in the child.
where is the solution video ?
It is throwing error:
ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value: 'undefined'. Current value: '[object Object]'.
Here even after implementing ngoninit life cycle hook I am getting error like can't read properties of undefined. What can be done
I had the same error :/
in the tsconfig file make "strict": false,
❤
I think there is a bug here. It works as like template reference variable.
Because when click close button of modal i make undefined the selectedProduct property. the modal close imediately because the whole product detail div and overaly div has condition to show only selectedProduct with value.this works fine when use template variable but in @ViewChild() first time click on product it shows the modal and after closing the modal when click on product again it does not show modal.
like your, i need to refresh my browser to works again.
I found that after close modal the second times any change does not detect.
static by default set to false not true.
Yes
code for color :
code for price :
Price Each Pair:
$
{{product.price}}
$
{{product.discountPrice}} (Inclusive of all taxes)
I am not getting the desired result.
Thank you ❤❤❤❤