ng-content in Angular | Directives | Angular 12+

  Рет қаралды 38,651

procademy

procademy

Күн бұрын

The ng-content is used when we want to insert the content dynamically inside the component that helps to increase component reusability.
Using ng-content we can pass content inside the component selector and when angular parses that content that appears at the place of ng-content.
Let's understand the use of ng-content with an example.

Пікірлер: 31
@arkoleini
@arkoleini 9 ай бұрын
Great job! I watched ng-content in two other paid courses on Udemy and did not find it as much as simple and clear explanation you did
@futurecodelab
@futurecodelab 7 ай бұрын
Thank you for equipping us with the knowledge and skills needed to master Angular development. Looking forward to diving deeper into this powerful framework with your guidance!
@AshokaJayasekara19
@AshokaJayasekara19 Жыл бұрын
You are explaining the concept very clearly!
@sohininandi9135
@sohininandi9135 Жыл бұрын
crystal clear explanation. 👍
@ArifMatubber-km4nv
@ArifMatubber-km4nv Жыл бұрын
Thank so much for the clearest explanation
@ahmedm_seada
@ahmedm_seada Жыл бұрын
That's a very great example . Thanks
@sona4612
@sona4612 Жыл бұрын
Wow ❤️❤️ what a clear explanation 🔥🔥
@JamesCarlton-vc2vw
@JamesCarlton-vc2vw 6 ай бұрын
Great explanation!
@monayemhossain5356
@monayemhossain5356 Жыл бұрын
Awesome tutorial. Hats off.
@klirmio21
@klirmio21 Жыл бұрын
very high tier content tbh
@afzalhossain4142
@afzalhossain4142 2 жыл бұрын
what a teaching!! wow
@maksat-mad
@maksat-mad Жыл бұрын
Great video, thank you!
@futurecodelab
@futurecodelab 7 ай бұрын
very clear
@nijilnmk7775
@nijilnmk7775 Жыл бұрын
super explanation
@muhidcs
@muhidcs 2 жыл бұрын
Great explanation, thanks!
@bullet7553
@bullet7553 7 ай бұрын
Thanks for this bu may we know if there is available source code so it would be much quicker to try?
@venkatesh-w4y
@venkatesh-w4y 10 ай бұрын
will this work when the child component has set the view encapsulation to shadow dom?
@dimon.digital
@dimon.digital Жыл бұрын
Thank you very much! 👍
@beksultanomirzak9803
@beksultanomirzak9803 6 ай бұрын
omg thank you so much!
@CHAIMASOMRANI
@CHAIMASOMRANI Жыл бұрын
thank you
@phileze_
@phileze_ Жыл бұрын
HI there, is there a reason to use ng-content when you can use *ngfor and achieve the same with even lesser code?
@ericculbertson1711
@ericculbertson1711 Жыл бұрын
I think having a "brand" variable within the product component, and then providing the 4 brands with an *ngfor is the best way to do this specific example. ng-content would be more flexible if you wanted to sometimes insert different kinds of components for each brand. (e.g. use h1 for iphone, h2 for Samsung, etc)
@Premek00
@Premek00 Жыл бұрын
You can think of ng-content as creating a slot for content, where you can insert anything. You can insert , , or custom components and it will work fine.
@yashkumarjani
@yashkumarjani 2 жыл бұрын
Helpful Video :)
@SreekanthKaringula
@SreekanthKaringula Жыл бұрын
what's the use of ng-content still the same lines of code is used here, but the code place is changed into component selector, where is code reusability here.
@ss_GOAT
@ss_GOAT 2 жыл бұрын
Thanks so much!
@boydde3de
@boydde3de Жыл бұрын
So, when using ng-content I should not apply the styles of that content to the child component, but to the parent component that injects the content in the child? What if I want to predefine the style of the content in the child component to make it easier to re-use?
@kabhishek4961
@kabhishek4961 2 жыл бұрын
Thank u..
@narenk8077
@narenk8077 2 жыл бұрын
Why your not said this is content projection?
@codewithdoge
@codewithdoge Жыл бұрын
You're taking too much time on explaining css and html rather than directly talking about ng content
@tsioryandrianarivony5437
@tsioryandrianarivony5437 Жыл бұрын
thank you
Angular Life Cycle Hooks | Lifecycle Hooks | Angular 12+
18:47
Angular Lifecycle Hook in Action | Lifecycle Hook | Angular 12+
29:33
They Chose Kindness Over Abuse in Their Team #shorts
00:20
I migliori trucchetti di Fabiosa
Рет қаралды 12 МЛН
How Much Tape To Stop A Lamborghini?
00:15
MrBeast
Рет қаралды 199 МЛН
ЛУЧШИЙ ФОКУС + секрет! #shorts
00:12
Роман Magic
Рет қаралды 37 МЛН
What’s new in Angular v18
20:08
Angular
Рет қаралды 134 М.
@ViewChild in Angular | Data Binding | Angular 12+
19:41
procademy
Рет қаралды 48 М.
Angular Content Projection: Everything You Need to Know
20:01
Code Shots With Profanis
Рет қаралды 10 М.
Subjects in RxJS | Observables | Angular 12+
16:14
procademy
Рет қаралды 57 М.
Custom appClass directive | Directives | Angular 12+
20:29
procademy
Рет қаралды 13 М.
Content Projection in Angular - Complete Guide (Beginners/Advanced)
26:18