@@ -1010,43 +1010,43 @@ function baseInputType(scope, element, attr, ctrl, $sniffer, $browser) {
1010
1010
}
1011
1011
1012
1012
function weekParser ( isoWeek ) {
1013
- if ( isDate ( isoWeek ) ) {
1014
- return isoWeek ;
1015
- }
1016
-
1017
- if ( isString ( isoWeek ) ) {
1018
- WEEK_REGEXP . lastIndex = 0 ;
1019
- var parts = WEEK_REGEXP . exec ( isoWeek ) ;
1020
- if ( parts ) {
1021
- var year = + parts [ 1 ] ,
1022
- week = + parts [ 2 ] ,
1023
- firstThurs = getFirstThursdayOfYear ( year ) ,
1024
- addDays = ( week - 1 ) * 7 ;
1025
- return new Date ( year , 0 , firstThurs . getDate ( ) + addDays ) ;
1026
- }
1027
- }
1013
+ if ( isDate ( isoWeek ) ) {
1014
+ return isoWeek ;
1015
+ }
1028
1016
1029
- return NaN ;
1017
+ if ( isString ( isoWeek ) ) {
1018
+ WEEK_REGEXP . lastIndex = 0 ;
1019
+ var parts = WEEK_REGEXP . exec ( isoWeek ) ;
1020
+ if ( parts ) {
1021
+ var year = + parts [ 1 ] ,
1022
+ week = + parts [ 2 ] ,
1023
+ firstThurs = getFirstThursdayOfYear ( year ) ,
1024
+ addDays = ( week - 1 ) * 7 ;
1025
+ return new Date ( year , 0 , firstThurs . getDate ( ) + addDays ) ;
1026
+ }
1027
+ }
1028
+
1029
+ return NaN ;
1030
1030
}
1031
1031
1032
1032
function createDateParser ( regexp , mapping ) {
1033
- return function ( iso ) {
1033
+ return function ( iso ) {
1034
1034
var parts , map ;
1035
1035
1036
- if ( isDate ( iso ) ) {
1037
- return iso ;
1036
+ if ( isDate ( iso ) ) {
1037
+ return iso ;
1038
1038
}
1039
1039
1040
- if ( isString ( iso ) ) {
1040
+ if ( isString ( iso ) ) {
1041
1041
regexp . lastIndex = 0 ;
1042
1042
parts = regexp . exec ( iso ) ;
1043
1043
1044
- if ( parts ) {
1044
+ if ( parts ) {
1045
1045
parts . shift ( ) ;
1046
1046
map = { yyyy : 1970 , MM : 1 , dd : 1 , HH : 0 , mm : 0 , ss : 0 } ;
1047
1047
1048
1048
forEach ( parts , function ( part , index ) {
1049
- if ( index < mapping . length ) {
1049
+ if ( index < mapping . length ) {
1050
1050
map [ mapping [ index ] ] = + part ;
1051
1051
}
1052
1052
} ) ;
@@ -1055,47 +1055,47 @@ function createDateParser(regexp, mapping) {
1055
1055
}
1056
1056
1057
1057
return NaN ;
1058
- } ;
1058
+ } ;
1059
1059
}
1060
1060
1061
1061
function createDateInputType ( type , regexp , parseDate , format ) {
1062
- return function dynamicDateInputType ( scope , element , attr , ctrl , $sniffer , $browser , $filter ) {
1063
- badInputChecker ( scope , element , attr , ctrl ) ;
1064
- baseInputType ( scope , element , attr , ctrl , $sniffer , $browser ) ;
1065
- var timezone = ctrl && ctrl . $options && ctrl . $options . timezone ;
1066
-
1067
- ctrl . $$parserName = type ;
1068
- ctrl . $parsers . push ( function ( value ) {
1069
- if ( ctrl . $isEmpty ( value ) ) return null ;
1070
- if ( regexp . test ( value ) ) {
1071
- var parsedDate = parseDate ( value ) ;
1072
- if ( timezone === 'UTC' ) {
1073
- parsedDate . setMinutes ( parsedDate . getMinutes ( ) - parsedDate . getTimezoneOffset ( ) ) ;
1074
- }
1075
- return parsedDate ;
1076
- }
1077
- return undefined ;
1078
- } ) ;
1079
-
1080
- ctrl . $formatters . push ( function ( value ) {
1081
- if ( isDate ( value ) ) {
1082
- return $filter ( 'date' ) ( value , format , timezone ) ;
1083
- }
1084
- return '' ;
1085
- } ) ;
1062
+ return function dynamicDateInputType ( scope , element , attr , ctrl , $sniffer , $browser , $filter ) {
1063
+ badInputChecker ( scope , element , attr , ctrl ) ;
1064
+ baseInputType ( scope , element , attr , ctrl , $sniffer , $browser ) ;
1065
+ var timezone = ctrl && ctrl . $options && ctrl . $options . timezone ;
1086
1066
1087
- if ( attr . min ) {
1088
- ctrl . $validators . min = function ( value ) {
1089
- return ctrl . $isEmpty ( value ) || isUndefined ( attr . min ) || parseDate ( value ) >= parseDate ( attr . min ) ;
1090
- } ;
1067
+ ctrl . $$parserName = type ;
1068
+ ctrl . $parsers . push ( function ( value ) {
1069
+ if ( ctrl . $isEmpty ( value ) ) return null ;
1070
+ if ( regexp . test ( value ) ) {
1071
+ var parsedDate = parseDate ( value ) ;
1072
+ if ( timezone === 'UTC' ) {
1073
+ parsedDate . setMinutes ( parsedDate . getMinutes ( ) - parsedDate . getTimezoneOffset ( ) ) ;
1074
+ }
1075
+ return parsedDate ;
1091
1076
}
1077
+ return undefined ;
1078
+ } ) ;
1092
1079
1093
- if ( attr . max ) {
1094
- ctrl . $validators . max = function ( value ) {
1095
- return ctrl . $isEmpty ( value ) || isUndefined ( attr . max ) || parseDate ( value ) <= parseDate ( attr . max ) ;
1096
- } ;
1080
+ ctrl . $formatters . push ( function ( value ) {
1081
+ if ( isDate ( value ) ) {
1082
+ return $filter ( 'date' ) ( value , format , timezone ) ;
1097
1083
}
1098
- } ;
1084
+ return '' ;
1085
+ } ) ;
1086
+
1087
+ if ( attr . min ) {
1088
+ ctrl . $validators . min = function ( value ) {
1089
+ return ctrl . $isEmpty ( value ) || isUndefined ( attr . min ) || parseDate ( value ) >= parseDate ( attr . min ) ;
1090
+ } ;
1091
+ }
1092
+
1093
+ if ( attr . max ) {
1094
+ ctrl . $validators . max = function ( value ) {
1095
+ return ctrl . $isEmpty ( value ) || isUndefined ( attr . max ) || parseDate ( value ) <= parseDate ( attr . max ) ;
1096
+ } ;
1097
+ }
1098
+ } ;
1099
1099
}
1100
1100
1101
1101
function badInputChecker ( scope , element , attr , ctrl ) {
@@ -1115,8 +1115,8 @@ function numberInputType(scope, element, attr, ctrl, $sniffer, $browser) {
1115
1115
1116
1116
ctrl . $$parserName = 'number' ;
1117
1117
ctrl . $parsers . push ( function ( value ) {
1118
- if ( ctrl . $isEmpty ( value ) ) return null ;
1119
- if ( NUMBER_REGEXP . test ( value ) ) return parseFloat ( value ) ;
1118
+ if ( ctrl . $isEmpty ( value ) ) return null ;
1119
+ if ( NUMBER_REGEXP . test ( value ) ) return parseFloat ( value ) ;
1120
1120
return undefined ;
1121
1121
} ) ;
1122
1122
@@ -1528,7 +1528,7 @@ var VALID_CLASS = 'ng-valid',
1528
1528
restrict: 'A', // only activate on element attribute
1529
1529
require: '?ngModel', // get a hold of NgModelController
1530
1530
link: function(scope, element, attrs, ngModel) {
1531
- if(!ngModel) return; // do nothing if no ng-model
1531
+ if (!ngModel) return; // do nothing if no ng-model
1532
1532
1533
1533
// Specify how UI should be updated
1534
1534
ngModel.$render = function() {
@@ -1546,7 +1546,7 @@ var VALID_CLASS = 'ng-valid',
1546
1546
var html = element.html();
1547
1547
// When we clear the content editable the browser leaves a <br> behind
1548
1548
// If strip-br attribute is provided then we strip this out
1549
- if( attrs.stripBr && html == '<br>' ) {
1549
+ if ( attrs.stripBr && html == '<br>' ) {
1550
1550
html = '';
1551
1551
}
1552
1552
ngModel.$setViewValue(html);
@@ -1693,7 +1693,7 @@ var NgModelController = ['$scope', '$exceptionHandler', '$attrs', '$element', '$
1693
1693
1694
1694
// just incase an asnyc validator is still running while
1695
1695
// the parser fails
1696
- if ( ctrl . $pending ) {
1696
+ if ( ctrl . $pending ) {
1697
1697
ctrl . $$clearPending ( ) ;
1698
1698
}
1699
1699
@@ -1777,7 +1777,7 @@ var NgModelController = ['$scope', '$exceptionHandler', '$attrs', '$element', '$
1777
1777
ctrl . $valid = true ;
1778
1778
ctrl . $invalid = false ;
1779
1779
}
1780
- } else if ( ! $error [ validationErrorKey ] ) {
1780
+ } else if ( ! $error [ validationErrorKey ] ) {
1781
1781
invalidCount ++ ;
1782
1782
if ( ! pendingCount ) {
1783
1783
toggleValidCss ( false ) ;
@@ -1933,7 +1933,7 @@ var NgModelController = ['$scope', '$exceptionHandler', '$attrs', '$element', '$
1933
1933
this . $$runValidators = function ( modelValue , viewValue ) {
1934
1934
// this is called in the event if incase the input value changes
1935
1935
// while a former asynchronous validator is still doing its thing
1936
- if ( ctrl . $pending ) {
1936
+ if ( ctrl . $pending ) {
1937
1937
ctrl . $$clearPending ( ) ;
1938
1938
}
1939
1939
@@ -2001,7 +2001,7 @@ var NgModelController = ['$scope', '$exceptionHandler', '$attrs', '$element', '$
2001
2001
var hasBadInput , modelValue = viewValue ;
2002
2002
for ( var i = 0 ; i < ctrl . $parsers . length ; i ++ ) {
2003
2003
modelValue = ctrl . $parsers [ i ] ( modelValue ) ;
2004
- if ( isUndefined ( modelValue ) ) {
2004
+ if ( isUndefined ( modelValue ) ) {
2005
2005
hasBadInput = true ;
2006
2006
break ;
2007
2007
}
@@ -2092,11 +2092,11 @@ var NgModelController = ['$scope', '$exceptionHandler', '$attrs', '$element', '$
2092
2092
options = ctrl . $options ,
2093
2093
debounce ;
2094
2094
2095
- if ( options && isDefined ( options . debounce ) ) {
2095
+ if ( options && isDefined ( options . debounce ) ) {
2096
2096
debounce = options . debounce ;
2097
- if ( isNumber ( debounce ) ) {
2097
+ if ( isNumber ( debounce ) ) {
2098
2098
debounceDelay = debounce ;
2099
- } else if ( isNumber ( debounce [ trigger ] ) ) {
2099
+ } else if ( isNumber ( debounce [ trigger ] ) ) {
2100
2100
debounceDelay = debounce [ trigger ] ;
2101
2101
} else if ( isNumber ( debounce [ 'default' ] ) ) {
2102
2102
debounceDelay = debounce [ 'default' ] ;
@@ -2452,7 +2452,7 @@ var patternDirective = function() {
2452
2452
2453
2453
var regexp , patternExp = attr . ngPattern || attr . pattern ;
2454
2454
attr . $observe ( 'pattern' , function ( regex ) {
2455
- if ( isString ( regex ) && regex . length > 0 ) {
2455
+ if ( isString ( regex ) && regex . length > 0 ) {
2456
2456
regex = new RegExp ( regex ) ;
2457
2457
}
2458
2458
0 commit comments