@@ -251,8 +251,10 @@ function($ionicTemplateLoader, $ionicBackdrop, $q, $timeout, $rootScope, $ionicB
251
251
* cssClass: '', // String, The custom CSS class name
252
252
* subTitle: '', // String (optional). The sub-title of the popup.
253
253
* template: '', // String (optional). The html template to place in the popup body.
254
- * templateUrl: '', // String (optional). The URL of an html template to place in the popup body.
254
+ * templateUrl: '', // String (optional). The URL of an html template to place in the popup body.
255
255
* inputType: // String (default: 'text'). The type of input to use
256
+ * defaultText: // String (default: ''). The initial value placed into the input.
257
+ * maxLength: // Integer (default: null). Specify a maxlength attribute for the input.
256
258
* inputPlaceholder: // String (default: ''). A placeholder to use for the input.
257
259
* cancelText: // String (default: 'Cancel'. The text of the Cancel button.
258
260
* cancelType: // String (default: 'button-default'). The type of the Cancel button.
@@ -464,14 +466,21 @@ function($ionicTemplateLoader, $ionicBackdrop, $q, $timeout, $rootScope, $ionicB
464
466
function showPrompt ( opts ) {
465
467
var scope = $rootScope . $new ( true ) ;
466
468
scope . data = { } ;
469
+ scope . data . fieldtype = opts . inputType ? opts . inputType : 'text' ;
470
+ scope . data . response = opts . defaultText ? opts . defaultText : '' ;
471
+ scope . data . placeholder = opts . inputPlaceholder ? opts . inputPlaceholder : '' ;
472
+ scope . data . maxlength = opts . maxLength ? parseInt ( opts . maxLength ) : '' ;
467
473
var text = '' ;
468
474
if ( opts . template && / < [ a - z ] [ \s \S ] * > / i. test ( opts . template ) === false ) {
469
475
text = '<span>' + opts . template + '</span>' ;
470
476
delete opts . template ;
471
477
}
472
478
return showPopup ( extend ( {
473
- template : text + '<input ng-model="data.response" type="' + ( opts . inputType || 'text' ) +
474
- '" placeholder="' + ( opts . inputPlaceholder || '' ) + '">' ,
479
+ template : text + '<input ng-model="data.response" '
480
+ + 'type="{{ data.fieldtype }}"'
481
+ + 'maxlength="{{ data.maxlength }}"'
482
+ + 'placeholder="{{ data.placeholder }}"'
483
+ + '>' ,
475
484
scope : scope ,
476
485
buttons : [ {
477
486
text : opts . cancelText || 'Cancel' ,
0 commit comments