Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit a942153

Browse files
committedDec 4, 2015
.prompt() now supports maxLength option. #4704
1 parent 2d1b2e0 commit a942153

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed
 

‎js/angular/service/popup.js

+7-3
Original file line numberDiff line numberDiff line change
@@ -251,9 +251,10 @@ function($ionicTemplateLoader, $ionicBackdrop, $q, $timeout, $rootScope, $ionicB
251251
* cssClass: '', // String, The custom CSS class name
252252
* subTitle: '', // String (optional). The sub-title of the popup.
253253
* 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.
255255
* inputType: // String (default: 'text'). The type of input to use
256256
* defaultText: // String (default: ''). The initial value placed into the input.
257+
* maxLength: // Integer (default: null). Specify a maxlength attribute for the input.
257258
* inputPlaceholder: // String (default: ''). A placeholder to use for the input.
258259
* cancelText: // String (default: 'Cancel'. The text of the Cancel button.
259260
* cancelType: // String (default: 'button-default'). The type of the Cancel button.
@@ -472,8 +473,11 @@ function($ionicTemplateLoader, $ionicBackdrop, $q, $timeout, $rootScope, $ionicB
472473
delete opts.template;
473474
}
474475
return showPopup(extend({
475-
template: text + '<input ng-model="data.response" type="' + (opts.inputType || 'text') +
476-
'" placeholder="' + (opts.inputPlaceholder || '') + '">',
476+
template: text + '<input ng-model="data.response" '
477+
+ 'type="' + (opts.inputType || 'text') + '" '
478+
+ (opts.maxLength ? 'maxlength="'+parseInt(opts.maxLength)+'" ' : '')
479+
+ 'placeholder="' + (opts.inputPlaceholder || '') + '"'
480+
+ '>',
477481
scope: scope,
478482
buttons: [{
479483
text: opts.cancelText || 'Cancel',

0 commit comments

Comments
 (0)
Please sign in to comment.