Skip to content
This repository was archived by the owner on Apr 20, 2023. It is now read-only.

Commit b95931c

Browse files
committed
Update angular-confirm.js
Supporting customized response messages allows custom templates to offer more than the standard 'ok' and 'cancel' buttons.
1 parent 83cfdc1 commit b95931c

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

angular-confirm.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,13 @@ angular.module('angular-confirm', ['ui.bootstrap.modal'])
2424
.controller('ConfirmModalController', function ($scope, $uibModalInstance, data) {
2525
$scope.data = angular.copy(data);
2626

27-
$scope.ok = function () {
28-
$uibModalInstance.close();
27+
$scope.ok = function (closeMessage) {
28+
$uibModalInstance.close(closeMessage);
2929
};
3030

31-
$scope.cancel = function () {
32-
$uibModalInstance.dismiss('cancel');
31+
$scope.cancel = function (dismissMessage) {
32+
if (typeof dismissMessage === 'undefined') dismissMessage = 'cancel';
33+
$uibModalInstance.dismiss(dismissMessage);
3334
};
3435

3536
})
@@ -108,4 +109,4 @@ angular.module('angular-confirm', ['ui.bootstrap.modal'])
108109
}
109110
}
110111
});
111-
}));
112+
}));

0 commit comments

Comments
 (0)