Build Angular Modal Without Libs - Angular Dynamic Component

  Рет қаралды 17,490

Monsterlessons Academy

Monsterlessons Academy

Күн бұрын

Пікірлер: 75
@MonsterlessonsAcademy
@MonsterlessonsAcademy Ай бұрын
WATCH NEXT: Angular Unit Testing Course - All That You Need to Know About Testing - kzbin.info/www/bejne/mKecq5KLm7ikna8si=WVzOWtdQUZWEbqsz
@ytamb01
@ytamb01 Жыл бұрын
Great tutorial. This highlights the things you need to consider if you write a custom modal. It also helps you understand the implementation in libraries like ng-bootstrap. Thanks.
@MonsterlessonsAcademy
@MonsterlessonsAcademy Жыл бұрын
Glad to hear that!
@Yarinmimon
@Yarinmimon Жыл бұрын
Man,i consider myself a very productive angular developer since im very experienced, but you are literally fluent. Very nice deep comprehension of this amazing fw, btw are you freelance?
@MonsterlessonsAcademy
@MonsterlessonsAcademy Жыл бұрын
Thank you! No I'm not.
@shieth314
@shieth314 6 ай бұрын
Incredible video! I always benefit from your videos, particularly at work. Thank you very much for your hard work! I would like to suggest utilizing diagrams to explain the outline of the process for those whom rely on aids for visualization, such as myself.
@MonsterlessonsAcademy
@MonsterlessonsAcademy 6 ай бұрын
Thanks!
@shieth314
@shieth314 6 ай бұрын
@@MonsterlessonsAcademy You are most welcome!
@EduardoMartinez-dm5pp
@EduardoMartinez-dm5pp 11 ай бұрын
You've been saving my ass for the past 6 months at my job hahahaha thank you so much dear friend!
@MonsterlessonsAcademy
@MonsterlessonsAcademy 11 ай бұрын
Glad to hear that!
@eduardodavila5213
@eduardodavila5213 3 ай бұрын
Monsterlessons rocks!! 💪
@MonsterlessonsAcademy
@MonsterlessonsAcademy 3 ай бұрын
Thank you!
@AfolabiJude
@AfolabiJude Жыл бұрын
This video is highly recommended
@MonsterlessonsAcademy
@MonsterlessonsAcademy Жыл бұрын
Thank you!
@rahultej8352
@rahultej8352 Жыл бұрын
Thank you, great work. Why dint you cinsider to detach the modal component when closed
@MolotovClipes
@MolotovClipes Жыл бұрын
Wowww, insane tutorial! Thanks a lot.
@MonsterlessonsAcademy
@MonsterlessonsAcademy Жыл бұрын
Glad you liked it!
@oladipogeorge5282
@oladipogeorge5282 Жыл бұрын
Hello. Me again. How do you send dynamic data through the modal? Hardcoded content shows: TEST But if I try and send dynamic data from the component, it doesn't show: {{ heading }} Would really appreciate your help.
Ай бұрын
Hard to tell without seeing what you’ve done.. But probably heading is empty or null
@christcp9014
@christcp9014 Жыл бұрын
MonsterLessons👍
@MonsterlessonsAcademy
@MonsterlessonsAcademy Жыл бұрын
Thanks!
@kol4an721
@kol4an721 Жыл бұрын
Great video. A have one question. How I can customise these modal? A want to open these modal, but I don’t want to use static component. Me need the hand over any component to openModal method and open the modal using component which I hand over in those method. How I can doing this? Thanks for answer
@MonsterlessonsAcademy
@MonsterlessonsAcademy Жыл бұрын
We provide inside a template. You can render whatever inside it.
@ARShindouAR
@ARShindouAR 8 ай бұрын
Deep understanding of Angular
@MonsterlessonsAcademy
@MonsterlessonsAcademy 8 ай бұрын
Thank you!
@ARShindouAR
@ARShindouAR 8 ай бұрын
@@MonsterlessonsAcademy Btw, is this way like to create a common modal service? Like dialog component in Angular Material? We can define our own dialog UI. and invoke this service to create Modal component?
@donachou2011
@donachou2011 4 ай бұрын
hello great video please i would like to know how to implement this modal open with componentRef instead of templateRef
@MonsterlessonsAcademy
@MonsterlessonsAcademy 4 ай бұрын
The vidoe about it is coming soon. Stay tuned.
@rajapattai
@rajapattai Жыл бұрын
Hi you are doing awesome. can you please let us know what VIM based editor are you using. and please post a full PROD ready ANGULAR Application with DB connection with authentication and authorization ?
@MonsterlessonsAcademy
@MonsterlessonsAcademy Жыл бұрын
Hi, here is my video about Vim kzbin.info/www/bejne/j6Ovmqidec12q80. The config is in the description. I already have a course with Socket IO, Angular, Typescript, NodeJS, Express, Mongodb and Deployment monsterlessons-academy.com/courses/build-fullstack-trello-clone-websocket-socket-io
@tmsmiffs
@tmsmiffs Жыл бұрын
Very nice! If your modal content is a form, how would you generically handle the submit with the modal's confirm button?
@MonsterlessonsAcademy
@MonsterlessonsAcademy Жыл бұрын
Just pass data outside when modal is submitted
@khnykinartem3123
@khnykinartem3123 Жыл бұрын
how do it?@@MonsterlessonsAcademy
@anirbandas12
@anirbandas12 Жыл бұрын
seems formcontrol bindings and dynamic data in the ng template that is to be put in the body is not working
@johnhashim2854
@johnhashim2854 Жыл бұрын
Great Content, Thanks
@MonsterlessonsAcademy
@MonsterlessonsAcademy Жыл бұрын
Glad to hear that!
@MolotovClipes
@MolotovClipes Жыл бұрын
In open(content: TemplateRef) if i need pass a component, how i get rootNodes to this case ?
@MonsterlessonsAcademy
@MonsterlessonsAcademy Жыл бұрын
If you want to pass a comp inside you need to tune it for your needs. You can find some examples in internet.
@MolotovClipes
@MolotovClipes Жыл бұрын
@@MonsterlessonsAcademy thanks, i got
@zangzang4364
@zangzang4364 4 күн бұрын
thanks for the video, but i cant use Reactive Form with this
@MonsterlessonsAcademy
@MonsterlessonsAcademy 3 күн бұрын
You are welcome!
@claudiotorres9138
@claudiotorres9138 Жыл бұрын
another question, it is necessary that the openModal method is in the appComponent file? Could it be in the component file of the template which opens the modal?
@MonsterlessonsAcademy
@MonsterlessonsAcademy Жыл бұрын
You can tune the code like you need
@claudiotorres9138
@claudiotorres9138 Жыл бұрын
it shows ComponentFactoryResolver as deprecated in import, can you tell me how to use it the actual way please?
@MonsterlessonsAcademy
@MonsterlessonsAcademy Жыл бұрын
I didn't try the newer variant but it looks like this is the correct usage const component = this.viewContainerRef.createComponent(YourElement);
@sergeydiachenko1429
@sergeydiachenko1429 Жыл бұрын
​@@MonsterlessonsAcademyBut, you can't use viewContainerRef inside a service class
@karthikeyan878
@karthikeyan878 Жыл бұрын
Please make a video on Angular "module" vs "library".
@MonsterlessonsAcademy
@MonsterlessonsAcademy Жыл бұрын
Thank you for the idea. I will add it to the list.
@imarveldesignsolutions9428
@imarveldesignsolutions9428 Жыл бұрын
Can you have a custom component inside an ng-template? For example: , I have followed this video and everything works great, but when i add a custom component it doesn't show, but it does if i use normal html.
@MonsterlessonsAcademy
@MonsterlessonsAcademy Жыл бұрын
Works for me This is our custom modal content
@imarveldesignsolutions9428
@imarveldesignsolutions9428 Жыл бұрын
@@MonsterlessonsAcademy Thanks for getting back to me. I created an Input component, and added it to the ng-template of that modal, but it doesn't seem to be working.
@imarveldesignsolutions9428
@imarveldesignsolutions9428 Жыл бұрын
@@MonsterlessonsAcademy Hi. I have just done a Foo component and that is working, but just doesn't seem to be working with my custom Input component: I can see that there is a label and input tag in the console, but nothing is being sent over.
@_Greenflag_
@_Greenflag_ Жыл бұрын
@@imarveldesignsolutions9428 @MonsterlessonsAcademy ahah, I think I found the bug. You should not pass 'null' to the createEmbeddedView, because the content will not be projected correctly. Use a modern approach with a ViewContainerRef and project vcr.createEmbeddedView(content);. If you use null and project a mat-icon in your ng-template (or any other 'dependancies' it will not work)
@pietrocurcio964
@pietrocurcio964 4 ай бұрын
@@imarveldesignsolutions9428 Hi! Did you manage to solve this porblem? I need help passing custom components to it
@howdy_suraj
@howdy_suraj Жыл бұрын
How can we implement it without using deprecated stuff
@MonsterlessonsAcademy
@MonsterlessonsAcademy Жыл бұрын
You can check documentation and update your code accordingly. Videos content gets outdated with time.
@sameerdas3672
@sameerdas3672 Жыл бұрын
But componentFactoryResolver is deprecated. How can we achieve the same without it?
@MonsterlessonsAcademy
@MonsterlessonsAcademy Жыл бұрын
Note: since v13, dynamic component creation via ViewContainerRef.createComponent does not require resolving component factory: component class can be used directly. angular.io/api/core/ComponentFactoryResolver
@sergeydiachenko1429
@sergeydiachenko1429 Жыл бұрын
@@MonsterlessonsAcademy you can't use ViewContainerRef inside Service class. How to make this logic using the service?
@neon_342
@neon_342 Жыл бұрын
#monsterlessons component factory resolver is deprecated, can you suggest method which works i mean a quickfix please asap
@MonsterlessonsAcademy
@MonsterlessonsAcademy Жыл бұрын
Note: since v13, dynamic component creation via ViewContainerRef.createComponent does not require resolving component factory: component class can be used directly. angular.io/api/core/ComponentFactoryResolver
@neon_342
@neon_342 Жыл бұрын
#monsterlessons am struggling to fix it in your project. Can you help me out to implement it there only ?
@_Greenflag_
@_Greenflag_ Жыл бұрын
The place where you call it : @ViewChild('view', { static: true, read: ViewContainerRef }) vcr!: ViewContainerRef; openModal(modalTemplate: TemplateRef) { this.modalService.open(this.vcr, modalTemplate, { title: 'Editer', }); } The Service : export class ModalService { constructor(private injector: Injector, private cdr: ApplicationRef) {} open( vcr: ViewContainerRef, content: TemplateRef, options?: { title?: string } ) { vcr.clear(); const innerContent = content.createEmbeddedView(null); const newComponentRef = vcr.createComponent(ModalComponent, { injector: this.injector, projectableNodes: [innerContent.rootNodes], }); newComponentRef.instance.title = options?.title; this.cdr.tick(); } }
@skidrow7930
@skidrow7930 Жыл бұрын
как закрывать модалку с помощью кнопки которая находится в ngcontent?
@claudiotorres9138
@claudiotorres9138 Жыл бұрын
where do we define what goes inside ng-content?
@MonsterlessonsAcademy
@MonsterlessonsAcademy Жыл бұрын
Inside the call of the modal in html
@RazDva-lg4is
@RazDva-lg4is Жыл бұрын
ComponentFactoryResolver and other staff are already deprecated
@kflo411
@kflo411 Жыл бұрын
Moh-dal. Like total.
@user-td8eh3fu5w
@user-td8eh3fu5w Жыл бұрын
1st!
@himanshubansal6425
@himanshubansal6425 Жыл бұрын
You do not unsubscribe events
@MonsterlessonsAcademy
@MonsterlessonsAcademy Жыл бұрын
You don't need to unsubscribe from outputs as they are not a custom subscribe.
@testblh
@testblh Жыл бұрын
2nd!!😉
@sergeydiachenko1429
@sergeydiachenko1429 Жыл бұрын
WTF? ComponentFactoryResolver is deprecated
@MonsterlessonsAcademy
@MonsterlessonsAcademy Жыл бұрын
You can check documentation and update your code accordingly. Videos content gets outdated with time.
@sergeydiachenko1429
@sergeydiachenko1429 Жыл бұрын
@@MonsterlessonsAcademy this means that your video is already outdated.
Build Angular Tooltip Without Libs - Angular Dynamic Component
11:57
Monsterlessons Academy
Рет қаралды 6 М.
Angular Unit Testing Crash Course - Make Your Project Bullet Proof
19:48
Monsterlessons Academy
Рет қаралды 15 М.
This mother's baby is too unreliable.
00:13
FUNNY XIAOTING 666
Рет қаралды 39 МЛН
My Daughter's Dumplings Are Filled With Coins #funny #cute #comedy
00:18
Funny daughter's daily life
Рет қаралды 32 МЛН
How to Display Modal Popup Form in Angular using NgBootstrap and FormsModule
9:59
Angular Authentication and Authorization - The Correct Way
23:30
Monsterlessons Academy
Рет қаралды 33 М.
Young People Try Windows XP
14:19
Linus Tech Tips
Рет қаралды 1,4 МЛН
Dynamic Component in Angular (2024)
17:48
Decoded Frontend
Рет қаралды 21 М.
How to Connect Firebase to Angular Project - Do It Right
20:36
Monsterlessons Academy
Рет қаралды 10 М.
Angular Menu: A Step-by-Step Tutorial
21:23
Monsterlessons Academy
Рет қаралды 6 М.
How to Make Modal in Angular | Build Custom Dialog in Angular
25:15
Angular Course with NgRx - Building Angular Project From Scratch
2:10:42
Monsterlessons Academy
Рет қаралды 35 М.
This mother's baby is too unreliable.
00:13
FUNNY XIAOTING 666
Рет қаралды 39 МЛН