forked from jameskleeh/angular-confirm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
angular-confirm.min.js
7 lines (7 loc) · 1.82 KB
/
angular-confirm.min.js
1
2
3
4
5
6
7
/*
* angular-confirm
* https://github.com/Schlogen/angular-confirm
* @version v1.2.3 - 2016-01-26
* @license Apache
*/
!function(n,e){"use strict";if("function"==typeof define&&define.amd)define(["angular"],e);else{if("undefined"==typeof module||"object"!=typeof module.exports)return e(n.angular);module.exports=e(require("angular"))}}(this,function(n){n.module("angular-confirm",["ui.bootstrap.modal"]).controller("ConfirmModalController",["$scope","$uibModalInstance","data",function(e,t,i){e.data=n.copy(i),e.ok=function(n){t.close(n)},e.cancel=function(e){n.isUndefined(e)&&(e="cancel"),t.dismiss(e)}}]).value("$confirmModalDefaults",{template:'<div class="modal-header"><h3 class="modal-title">{{data.title}}</h3></div><div class="modal-body">{{data.text}}</div><div class="modal-footer"><button class="btn btn-primary" ng-click="ok()">{{data.ok}}</button><button class="btn btn-default" ng-click="cancel()">{{data.cancel}}</button></div>',controller:"ConfirmModalController",defaultLabels:{title:"Confirm",ok:"OK",cancel:"Cancel"}}).factory("$confirm",["$uibModal","$confirmModalDefaults",function(e,t){return function(i,o){var c=n.copy(t);return o=n.extend(c,o||{}),i=n.extend({},o.defaultLabels,i||{}),"templateUrl"in o&&"template"in o&&delete o.template,o.resolve={data:function(){return i}},e.open(o).result}}]).directive("confirm",["$confirm",function(e){return{priority:1,restrict:"A",scope:{confirmIf:"=",ngClick:"&",confirm:"@",confirmSettings:"=",confirmTitle:"@",confirmOk:"@",confirmCancel:"@"},link:function(t,i,o){i.unbind("click").bind("click",function(i){if(i.preventDefault(),n.isUndefined(t.confirmIf)||t.confirmIf){var o={text:t.confirm};t.confirmTitle&&(o.title=t.confirmTitle),t.confirmOk&&(o.ok=t.confirmOk),t.confirmCancel&&(o.cancel=t.confirmCancel),e(o,t.confirmSettings||{}).then(t.ngClick)}else t.$apply(t.ngClick)})}}}])});