@@ -17,7 +17,9 @@ var inputType = {
1717 * @name input[text]
1818 *
1919 * @description
20- * Standard HTML text input with angular data binding.
20+ * Standard HTML text input with angular data binding, inherited by most of the `input` elements.
21+ *
22+ * *NOTE* Not every feature offered is available for all input types.
2123 *
2224 * @param {string } ngModel Assignable angular expression to data-bind to.
2325 * @param {string= } name Property name of the form under which the control is published.
@@ -35,6 +37,8 @@ var inputType = {
3537 * @param {string= } ngChange Angular expression to be executed when input changes due to user
3638 * interaction with the input element.
3739 * @param {boolean= } [ngTrim=true] If set to false Angular will not automatically trim the input.
40+ * This parameter is ignored for input[type=password] controls, which will never trim the
41+ * input.
3842 *
3943 * @example
4044 <example name="text-input-directive" module="textInputExample">
@@ -474,6 +478,7 @@ function addNativeHtml5Validators(ctrl, validatorName, badFlags, ignoreFlags, va
474478function textInputType ( scope , element , attr , ctrl , $sniffer , $browser ) {
475479 var validity = element . prop ( VALIDITY_STATE_PROPERTY ) ;
476480 var placeholder = element [ 0 ] . placeholder , noevent = { } ;
481+ var type = element [ 0 ] . type . toLowerCase ( ) ;
477482 ctrl . $$validityState = validity ;
478483
479484 // In composition mode, users are still inputing intermediate text buffer,
@@ -507,8 +512,8 @@ function textInputType(scope, element, attr, ctrl, $sniffer, $browser) {
507512
508513 // By default we will trim the value
509514 // If the attribute ng-trim exists we will avoid trimming
510- // e.g. < input ng-model="foo" ng-trim="false">
511- if ( toBoolean ( attr . ngTrim || 'T' ) ) {
515+ // If input type is 'password', the value is never trimmed
516+ if ( type !== 'password' && ( toBoolean ( attr . ngTrim || 'T' ) ) ) {
512517 value = trim ( value ) ;
513518 }
514519
@@ -783,6 +788,8 @@ function checkboxInputType(scope, element, attr, ctrl) {
783788 * HTML input element control with angular data-binding. Input control follows HTML5 input types
784789 * and polyfills the HTML5 validation behavior for older browsers.
785790 *
791+ * *NOTE* Not every feature offered is available for all input types.
792+ *
786793 * @param {string } ngModel Assignable angular expression to data-bind to.
787794 * @param {string= } name Property name of the form under which the control is published.
788795 * @param {string= } required Sets `required` validation error key if the value is not entered.
@@ -796,6 +803,9 @@ function checkboxInputType(scope, element, attr, ctrl) {
796803 * patterns defined as scope expressions.
797804 * @param {string= } ngChange Angular expression to be executed when input changes due to user
798805 * interaction with the input element.
806+ * @param {boolean= } [ngTrim=true] If set to false Angular will not automatically trim the input.
807+ * This parameter is ignored for input[type=password] controls, which will never trim the
808+ * input.
799809 *
800810 * @example
801811 <example name="input-directive" module="inputExample">
0 commit comments