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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

guyschlider opened this issue · comments

commented

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

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.