@@ -42,7 +42,8 @@ angular.module('angular-confirm', ['ui.bootstrap.modal'])
4242 title : 'Confirm' ,
4343 ok : 'OK' ,
4444 cancel : 'Cancel'
45- }
45+ } ,
46+ additionalTemplates : { }
4647 } )
4748 . factory ( '$confirm' , [ "$uibModal" , "$confirmModalDefaults" , function ( $uibModal , $confirmModalDefaults ) {
4849 return function ( data , settings ) {
@@ -51,6 +52,14 @@ angular.module('angular-confirm', ['ui.bootstrap.modal'])
5152
5253 data = angular . extend ( { } , settings . defaultLabels , data || { } ) ;
5354
55+ if ( data . templateName ) {
56+ var customTemplateDefinition = settings . additionalTemplates [ data . templateName ] ;
57+ if ( customTemplateDefinition != undefined ) {
58+ settings . template = customTemplateDefinition . template ;
59+ settings . templateUrl = customTemplateDefinition . templateUrl ;
60+ }
61+ }
62+
5463 if ( 'templateUrl' in settings && 'template' in settings ) {
5564 delete settings . template ;
5665 }
@@ -73,6 +82,7 @@ angular.module('angular-confirm', ['ui.bootstrap.modal'])
7382 ngClick : '&' ,
7483 confirm : '@' ,
7584 confirmSettings : "=" ,
85+ confirmTemplateName : "=" ,
7686 confirmTitle : '@' ,
7787 confirmOk : '@' ,
7888 confirmCancel : '@'
@@ -110,6 +120,9 @@ angular.module('angular-confirm', ['ui.bootstrap.modal'])
110120 if ( scope . confirmCancel ) {
111121 data . cancel = scope . confirmCancel ;
112122 }
123+ if ( scope . confirmTemplateName ) {
124+ data . templateName = scope . confirmTemplateName ;
125+ }
113126 $confirm ( data , scope . confirmSettings || { } ) . then ( onSuccess ) ;
114127 } else {
115128 scope . $apply ( onSuccess ) ;
0 commit comments