Commit d0dcb6a421880e634978351a077be03a0d91a780
Exists in
master
and in
1 other branch
Merge branch 'master' into 'master'
opcion path en boton cancelar See merge request !3
Showing
2 changed files
Show diff stats
src/js/controller.js
1 | angular.module('focaBotoneraLateral') | 1 | angular.module('focaBotoneraLateral') |
2 | .controller('focaBotoneraLateralController', [ | 2 | .controller('focaBotoneraLateralController', [ |
3 | '$scope', | 3 | '$scope', |
4 | '$location', | 4 | '$location', |
5 | '$window', | 5 | '$window', |
6 | 'focaBotoneraLateralService', | 6 | 'focaBotoneraLateralService', |
7 | function($scope, $location, $window, focaBotoneraLateralService) { | 7 | function($scope, $location, $window, focaBotoneraLateralService) { |
8 | 8 | ||
9 | $scope.botones = focaBotoneraLateralService.botones; | 9 | $scope.botones = focaBotoneraLateralService.botones; |
10 | 10 | ||
11 | $scope.cambioUsoTeclado = function() { | 11 | $scope.cambioUsoTeclado = function() { |
12 | $scope.$parent.cambioUsoTeclado(); | 12 | $scope.$parent.cambioUsoTeclado(); |
13 | }; | 13 | }; |
14 | 14 | ||
15 | $scope.salir = function() { | 15 | $scope.salir = function() { |
16 | $location.path('/'); | 16 | $location.path('/'); |
17 | }; | 17 | }; |
18 | 18 | ||
19 | $scope.cancelar = function() { | 19 | $scope.cancelar = function() { |
20 | $window.history.back(); | 20 | if($scope.botones.pathCancelar) { |
21 | $location.path($scope.botones.pathCancelar); | ||
22 | }else { | ||
23 | $window.history.back(); | ||
24 | } | ||
21 | }; | 25 | }; |
22 | }]); | 26 | }]); |
23 | 27 |
src/js/service.js
1 | angular.module('focaBotoneraLateral') | 1 | angular.module('focaBotoneraLateral') |
2 | .service('focaBotoneraLateralService', function() { | 2 | .service('focaBotoneraLateralService', function() { |
3 | 3 | ||
4 | this.botones = { | 4 | this.botones = { |
5 | salir: false, | 5 | salir: false, |
6 | cancelar: false, | 6 | cancelar: false, |
7 | pausar: false, | 7 | pausar: false, |
8 | guardar: false, | 8 | guardar: false, |
9 | funcionGuardar: undefined | 9 | funcionGuardar: undefined, |
10 | pathCancelar: undefined | ||
10 | }; | 11 | }; |
11 | 12 | ||
12 | this.showSalir = function(value) { | 13 | this.showSalir = function(value) { |
13 | this.botones.salir = value; | 14 | this.botones.salir = value; |
14 | }; | 15 | }; |
15 | this.showPausar = function(value) { | 16 | this.showPausar = function(value) { |
16 | this.botones.pausar = value; | 17 | this.botones.pausar = value; |
17 | }; | 18 | }; |
18 | this.showCancelar = function(value, funcion) { | 19 | this.showCancelar = function(value, path) { |
19 | this.botones.cancelar = value; | 20 | this.botones.cancelar = value; |
20 | if(value) this.botones.funcionCancelar = funcion; | 21 | if(path) this.botones.pathCancelar = path; |
21 | }; | 22 | }; |
22 | this.showGuardar = function(value, funcion) { | 23 | this.showGuardar = function(value, funcion) { |
23 | this.botones.guardar = value; | 24 | this.botones.guardar = value; |
24 | if(value) this.botones.funcionGuardar = funcion; | 25 | if(value) this.botones.funcionGuardar = funcion; |
25 | }; | 26 | }; |
26 | 27 | ||
27 | }); | 28 | }); |
28 | 29 |