Commit ea3331c100776190388c23c1c24d3b7cf3ecdfdc
1 parent
a6bf328e03
Exists in
master
precommit
Showing
2 changed files
with
4 additions
and
4 deletions
Show diff stats
src/js/controller.js
1 | angular.module('focaModal') | 1 | angular.module('focaModal') |
2 | .controller('focaModalConfirmController', [ | 2 | .controller('focaModalConfirmController', [ |
3 | '$uibModalInstance', '$scope', 'text', | 3 | '$uibModalInstance', '$scope', 'text', |
4 | function($uibModalInstance, $scope, text) { | 4 | function($uibModalInstance, $scope, text) { |
5 | $scope.param = text; | 5 | $scope.param = text; |
6 | $scope.cancelar = function() { | 6 | $scope.cancelar = function() { |
7 | $uibModalInstance.close(false); | 7 | $uibModalInstance.close(false); |
8 | }; | 8 | }; |
9 | $scope.aceptar = function() { | 9 | $scope.aceptar = function() { |
10 | $uibModalInstance.close(true); | 10 | $uibModalInstance.close(true); |
11 | }; | 11 | }; |
12 | } | 12 | } |
13 | ]) | 13 | ]) |
14 | .controller('focaModalAlertController', [ | 14 | .controller('focaModalAlertController', [ |
15 | '$uibModalInstance', '$scope', 'text', | 15 | '$uibModalInstance', '$scope', 'text', |
16 | function($uibModalInstance, $scope, text) { | 16 | function($uibModalInstance, $scope, text) { |
17 | $scope.param = text; | 17 | $scope.param = text; |
18 | $scope.aceptar = function() { | 18 | $scope.aceptar = function() { |
19 | $uibModalInstance.close(true); | 19 | $uibModalInstance.close(true); |
20 | }; | 20 | }; |
21 | } | 21 | } |
22 | ]) |
src/js/service.js
1 | angular.module('focaModal') | 1 | angular.module('focaModal') |
2 | .service('modal', [ | 2 | .service('modal', [ |
3 | '$uibModal', | 3 | '$uibModal', |
4 | function ($uibModal) { | 4 | function ($uibModal) { |
5 | return { | 5 | return { |
6 | confirm: function (a) { | 6 | confirm: function (a) { |
7 | return $uibModal.open({ | 7 | return $uibModal.open({ |
8 | templateUrl: 'modal-confirm.html', | 8 | templateUrl: 'modal-confirm.html', |
9 | controller: 'focaModalConfirmController', | 9 | controller: 'focaModalConfirmController', |
10 | animation: false, | 10 | animation: false, |
11 | backdrop: false, | 11 | backdrop: false, |
12 | resolve: { text: function () { return a; } } | 12 | resolve: { text: function () { return a; } } |
13 | }) | 13 | }) |
14 | .result.then( | 14 | .result.then( |
15 | function (p) { | 15 | function (p) { |
16 | return p; | 16 | return p; |
17 | } | 17 | } |
18 | ) | 18 | ); |
19 | }, | 19 | }, |
20 | alert: function (a) { | 20 | alert: function (a) { |
21 | return $uibModal.open({ | 21 | return $uibModal.open({ |
22 | templateUrl: 'modal-alert.html', | 22 | templateUrl: 'modal-alert.html', |
23 | controller: 'focaModalAlertController', | 23 | controller: 'focaModalAlertController', |
24 | animation: false, | 24 | animation: false, |
25 | backdrop: false, | 25 | backdrop: false, |
26 | resolve: { text: function () { return a; } } | 26 | resolve: { text: function () { return a; } } |
27 | }) | 27 | }); |
28 | } | 28 | } |
29 | } | 29 | }; |
30 | } | 30 | } |
31 | ]); | 31 | ]); |
32 | 32 |