File tree 2 files changed +12
-2
lines changed
2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -2189,7 +2189,7 @@ var maxlengthDirective = function() {
2189
2189
ctrl . $validate ( ) ;
2190
2190
} ) ;
2191
2191
ctrl . $validators . maxlength = function ( value ) {
2192
- return ctrl . $isEmpty ( value ) || value . length <= maxlength ;
2192
+ return ctrl . $isEmpty ( value ) || value . toString ( ) . length <= maxlength ;
2193
2193
} ;
2194
2194
}
2195
2195
} ;
@@ -2207,7 +2207,7 @@ var minlengthDirective = function() {
2207
2207
ctrl . $validate ( ) ;
2208
2208
} ) ;
2209
2209
ctrl . $validators . minlength = function ( value ) {
2210
- return ctrl . $isEmpty ( value ) || value . length >= minlength ;
2210
+ return ctrl . $isEmpty ( value ) || value . toString ( ) . length >= minlength ;
2211
2211
} ;
2212
2212
}
2213
2213
} ;
Original file line number Diff line number Diff line change @@ -1400,6 +1400,11 @@ describe('input', function() {
1400
1400
1401
1401
changeInputValueTo ( 'aaa' ) ;
1402
1402
expect ( inputElm ) . toBeValid ( ) ;
1403
+
1404
+ scope . $apply ( function ( ) {
1405
+ scope . value = 1234 ;
1406
+ } ) ;
1407
+ expect ( inputElm ) . toBeValid ( ) ;
1403
1408
} ) ;
1404
1409
1405
1410
it ( 'should listen on ng-minlength when minlength is observed' , function ( ) {
@@ -1446,6 +1451,11 @@ describe('input', function() {
1446
1451
1447
1452
changeInputValueTo ( 'aaa' ) ;
1448
1453
expect ( inputElm ) . toBeValid ( ) ;
1454
+
1455
+ scope . $apply ( function ( ) {
1456
+ scope . value = 42 ;
1457
+ } ) ;
1458
+ expect ( inputElm ) . toBeValid ( ) ;
1449
1459
} ) ;
1450
1460
1451
1461
it ( 'should listen on ng-maxlength when maxlength is observed' , function ( ) {
You can’t perform that action at this time.
0 commit comments