@@ -384,11 +384,6 @@ var inputType = {
384
384
} ;
385
385
386
386
387
- function isEmpty ( value ) {
388
- return isUndefined ( value ) || value === '' || value === null || value !== value ;
389
- }
390
-
391
-
392
387
function textInputType ( scope , element , attr , ctrl , $sniffer , $browser ) {
393
388
394
389
var listener = function ( ) {
@@ -658,9 +653,8 @@ function checkboxInputType(scope, element, attr, ctrl) {
658
653
} ;
659
654
660
655
// Override the standard `$isEmpty` because a value of `false` means empty in a checkbox.
661
- var _$isEmpty = ctrl . $isEmpty ;
662
656
ctrl . $isEmpty = function ( value ) {
663
- return _$isEmpty ( value ) || value === false ;
657
+ return value !== trueValue ;
664
658
} ;
665
659
666
660
ctrl . $formatters . push ( function ( value ) {
@@ -1012,8 +1006,10 @@ var NgModelController = ['$scope', '$exceptionHandler', '$attrs', '$element', '$
1012
1006
* You can override this for input directives whose concept of being empty is different to the
1013
1007
* default. The `checkboxInputType` directive does this because in its case a value of `false`
1014
1008
* implies empty.
1015
- */
1016
- this . $isEmpty = isEmpty ;
1009
+ */
1010
+ this . $isEmpty = function ( value ) {
1011
+ return isUndefined ( value ) || value === '' || value === null || value !== value ;
1012
+ } ;
1017
1013
1018
1014
var parentForm = $element . inheritedData ( '$formController' ) || nullFormCtrl ,
1019
1015
invalidCount = 0 , // used to easily determine if we are valid
@@ -1365,7 +1361,7 @@ var ngListDirective = function() {
1365
1361
1366
1362
var parse = function ( viewValue ) {
1367
1363
// If the viewValue is invalid (say required but empty) it will be `undefined`
1368
- if ( isUndefined ( viewValue ) ) return ;
1364
+ if ( isUndefined ( viewValue ) ) return ;
1369
1365
1370
1366
var list = [ ] ;
1371
1367
@@ -1387,10 +1383,9 @@ var ngListDirective = function() {
1387
1383
return undefined ;
1388
1384
} ) ;
1389
1385
1390
- // Override the standard $isEmpty because an empty array means the input is empty
1391
- var _$isEmpty = ctrl . $isEmpty ;
1386
+ // Override the standard $isEmpty because an empty array means the input is empty.
1392
1387
ctrl . $isEmpty = function ( value ) {
1393
- return _$isEmpty ( value ) || value . length === 0 ;
1388
+ return ! value || ! value . length ;
1394
1389
} ;
1395
1390
}
1396
1391
} ;
0 commit comments