m-e-conroy / angular-dialog-service

A complete AngularJS service with controllers and templates for generating application modals and dialogs for use with Angular-UI-Bootstrap and Twitter Bootstrap
MIT License
618 stars 228 forks source link

How to override the default error/notify/etc.. templates #163

Open guyschlider opened 8 years ago

guyschlider commented 8 years ago

Hi,

Whats the best practice to override the default templates for error/notify/etc ? Should I change the digits.js module or there is another way?

thanks

Noch2d2 commented 8 years ago

The defaut templates are stored in the templateCache. You can use $templateCache.get() to retrieve the template that's defined for each of the cases you mentioned, then modify and replace it, or just overwrite it altogether with $templateCache.put().

For example, to change the default OK button style on the confirm template, I did this:

var tpc = $templateCache.get('/dialogs/confirm.html');
tpc = tpc.replace('btn-default', 'btn-success');
$templateCache.put('/dialogs/confirm.html',tpc);

I suppose I could have just done some style work to address this issue, but I was wondering how to get at the stuff anyway and this was the result.