From a814fff2f43ccba83413615def2285b7891f53ea Mon Sep 17 00:00:00 2001 From: Jose Pinto Date: Thu, 21 Feb 2019 17:58:38 -0300 Subject: [PATCH] agrego opcion readonly a modal prompt --- src/js/controller.js | 5 +++-- src/js/service.js | 6 ++++-- src/views/modal-prompt.html | 6 ++++-- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/js/controller.js b/src/js/controller.js index a8a21b4..258f8a1 100644 --- a/src/js/controller.js +++ b/src/js/controller.js @@ -34,8 +34,9 @@ angular.module('focaModal') } ]) .controller('focaModalPromptController', [ - '$uibModalInstance', '$scope', 'titulo', 'initValue', 'textarea', - function($uibModalInstance, $scope, titulo, initValue, textarea) { + '$uibModalInstance', '$scope', 'titulo', 'initValue', 'textarea', 'readonly', + function($uibModalInstance, $scope, titulo, initValue, textarea, readonly) { + $scope.readonly = readonly; $scope.textarea = textarea; $scope.titulo = titulo; $scope.value = initValue; diff --git a/src/js/service.js b/src/js/service.js index 2bdc4a7..71d12f9 100644 --- a/src/js/service.js +++ b/src/js/service.js @@ -71,8 +71,9 @@ angular.module('focaModal') } ); }, - prompt: function(titulo, initValue, textarea){ + prompt: function(titulo, initValue, textarea, readonly){ textarea = textarea ? true : false; + readonly = readonly ? true : false; return $uibModal.open({ templateUrl: 'modal-prompt.html', controller: 'focaModalPromptController', @@ -80,7 +81,8 @@ angular.module('focaModal') resolve: { titulo: function() {return titulo;}, initValue: function() {return initValue;}, - textarea: function() {return textarea;} + textarea: function() {return textarea;}, + readonly: function() {return readonly;} } }) .result.then( diff --git a/src/views/modal-prompt.html b/src/views/modal-prompt.html index 494486d..5be0bbb 100644 --- a/src/views/modal-prompt.html +++ b/src/views/modal-prompt.html @@ -6,13 +6,15 @@ type="text" class="form-control" ng-model="value" - ng-show="!textarea"> + ng-show="!textarea" + ng-readonly="readonly"> + ng-show="textarea" + ng-readonly="readonly">