@@ -899,7 +899,18 @@ function testFlags(validity, flags) {
899
899
return false ;
900
900
}
901
901
902
+ function stringBasedInputType ( ctrl ) {
903
+ ctrl . $formatters . push ( function ( value ) {
904
+ return ctrl . $isEmpty ( value ) ? value : value . toString ( ) ;
905
+ } ) ;
906
+ }
907
+
902
908
function textInputType ( scope , element , attr , ctrl , $sniffer , $browser ) {
909
+ baseInputType ( scope , element , attr , ctrl , $sniffer , $browser ) ;
910
+ stringBasedInputType ( ctrl ) ;
911
+ }
912
+
913
+ function baseInputType ( scope , element , attr , ctrl , $sniffer , $browser ) {
903
914
var validity = element . prop ( VALIDITY_STATE_PROPERTY ) ;
904
915
var placeholder = element [ 0 ] . placeholder , noevent = { } ;
905
916
var type = lowercase ( element [ 0 ] . type ) ;
@@ -1050,7 +1061,7 @@ function createDateParser(regexp, mapping) {
1050
1061
function createDateInputType ( type , regexp , parseDate , format ) {
1051
1062
return function dynamicDateInputType ( scope , element , attr , ctrl , $sniffer , $browser , $filter ) {
1052
1063
badInputChecker ( scope , element , attr , ctrl ) ;
1053
- textInputType ( scope , element , attr , ctrl , $sniffer , $browser ) ;
1064
+ baseInputType ( scope , element , attr , ctrl , $sniffer , $browser ) ;
1054
1065
var timezone = ctrl && ctrl . $options && ctrl . $options . timezone ;
1055
1066
1056
1067
ctrl . $$parserName = type ;
@@ -1100,7 +1111,7 @@ function badInputChecker(scope, element, attr, ctrl) {
1100
1111
1101
1112
function numberInputType ( scope , element , attr , ctrl , $sniffer , $browser ) {
1102
1113
badInputChecker ( scope , element , attr , ctrl ) ;
1103
- textInputType ( scope , element , attr , ctrl , $sniffer , $browser ) ;
1114
+ baseInputType ( scope , element , attr , ctrl , $sniffer , $browser ) ;
1104
1115
1105
1116
ctrl . $$parserName = 'number' ;
1106
1117
ctrl . $parsers . push ( function ( value ) {
@@ -1134,7 +1145,8 @@ function numberInputType(scope, element, attr, ctrl, $sniffer, $browser) {
1134
1145
1135
1146
function urlInputType ( scope , element , attr , ctrl , $sniffer , $browser ) {
1136
1147
badInputChecker ( scope , element , attr , ctrl ) ;
1137
- textInputType ( scope , element , attr , ctrl , $sniffer , $browser ) ;
1148
+ baseInputType ( scope , element , attr , ctrl , $sniffer , $browser ) ;
1149
+ stringBasedInputType ( ctrl ) ;
1138
1150
1139
1151
ctrl . $$parserName = 'url' ;
1140
1152
ctrl . $validators . url = function ( modelValue , viewValue ) {
@@ -1145,7 +1157,8 @@ function urlInputType(scope, element, attr, ctrl, $sniffer, $browser) {
1145
1157
1146
1158
function emailInputType ( scope , element , attr , ctrl , $sniffer , $browser ) {
1147
1159
badInputChecker ( scope , element , attr , ctrl ) ;
1148
- textInputType ( scope , element , attr , ctrl , $sniffer , $browser ) ;
1160
+ baseInputType ( scope , element , attr , ctrl , $sniffer , $browser ) ;
1161
+ stringBasedInputType ( ctrl ) ;
1149
1162
1150
1163
ctrl . $$parserName = 'email' ;
1151
1164
ctrl . $validators . email = function ( modelValue , viewValue ) {
@@ -2585,6 +2598,7 @@ var minlengthDirective = function() {
2585
2598
var ngListDirective = function ( ) {
2586
2599
return {
2587
2600
restrict : 'A' ,
2601
+ priority : 100 ,
2588
2602
require : 'ngModel' ,
2589
2603
link : function ( scope , element , attr , ctrl ) {
2590
2604
// We want to control whitespace trimming so we use this convoluted approach
0 commit comments