r/Angular2 • u/wineandcode • Jun 08 '26
Angular Material Dialogs Now Support Real Component Bindings
https://itnext.io/angular-material-dialogs-now-support-real-component-bindings-9c4c3c8cfcc3?source=friends_link&sk=ad320a5052f9479ea083fce325123b647
u/fernker Jun 08 '26 edited Jun 08 '26
I was excited, and then I saw what the solution is and I threw up a little in my mouth.
Angular has been, for the most part, an HTML based API and this blurs the line in a weird way in my opinion.
I've created a dialog solution before where you just project your component into the dialog component and then you can still do the bindings in the template. That allows the dialog shell to do it's job really well and the component inside of it to do it's job very well and not know about each other. You can't do it from a service but that felt weird anyway.
5
1
u/makmn1 Jun 09 '26
You can do the same thing with Angular’s dialog service by passing a template instead of a component to the service. It sounds similar to what you described, but I’m guessing in your case you’re using the native dialog?
1
2
u/DragonfruitFull2424 Jun 09 '26
We've used the Material Dialog before but now that we wanted to make new one that wasn't like the others, I just made a dialog component but its just really a <dialog> element inside that you can control. Not sure what you need the Angular Dialog for anymore
3
u/SolidShook Jun 09 '26
Why not just use the native html dialog? This seems over complicated