Closed mark0978 closed 10 years ago
Excellent! Thank you for sharing this, I've definitely learned something new.
@mark0978 if you set wc in the opts object to a CSS class this will set the windowClass. I like what you did with the decorator and I learned a lot actually by following the URL you put in the comments of your code, but the windowClass parameter for the Angular-UI-Bootstrap Modal is covered by this service. Maybe I didn't document it well enough.
This follows in the same spirit as the dialogs.dosomething pattern, so that the windowClass is just included without having to specify it everywhere. Just like you built out on top of modal, just thought it was a cool use of the decorator provider.
@mark0978 Ok, I understand now why you did it this way. Thanks for the how-to, like I said I learned something new yesterday, in fact I spent about half my work day reading up on different blogs about the "decorating," thanks so much.
What started out as a question: Why can't I override the template in the options? turned into a pretty neat way of extending the dialogs service to make it even easier to use.
I was trying to modify the confirmation dialog to confirm a deletion, where I wanted the confirmation to stand out with different colors. Turns out I can do it via the window class, but it actually turned out that in the process of getting this to work, I managed to extend your excellent
dialogs
module without having to touch the code.What I added was dialogs.confirmDeletion(header, msg, opts) which works like confirm, but provides default opts to help control the coloring.
To do this, I used the $provide.decorate to extend your dialogs module with the following code: