@@ -2050,14 +2050,20 @@ function $ParseProvider() {
2050
2050
} , listener , objectEquality , prettyPrintExpression ) ;
2051
2051
}
2052
2052
2053
- function oneTimeWatchDelegate ( scope , listener , objectEquality , parsedExpression ) {
2053
+ function oneTimeWatchDelegate ( scope , listener , objectEquality , parsedExpression , prettyPrintExpression ) {
2054
2054
var unwatch , lastValue ;
2055
- return unwatch = scope . $watch ( function oneTimeWatch ( scope ) {
2055
+ if ( parsedExpression . inputs ) {
2056
+ return unwatch = inputsWatchDelegate ( scope , oneTimeListener , objectEquality , parsedExpression , prettyPrintExpression ) ;
2057
+ } else {
2058
+ return unwatch = scope . $watch ( oneTimeWatch , oneTimeListener , objectEquality ) ;
2059
+ }
2060
+ function oneTimeWatch ( scope ) {
2056
2061
return parsedExpression ( scope ) ;
2057
- } , function oneTimeListener ( value , old , scope ) {
2062
+ }
2063
+ function oneTimeListener ( value , old , scope ) {
2058
2064
lastValue = value ;
2059
2065
if ( isFunction ( listener ) ) {
2060
- listener . apply ( this , arguments ) ;
2066
+ listener ( value , old , scope ) ;
2061
2067
}
2062
2068
if ( isDefined ( value ) ) {
2063
2069
scope . $$postDigest ( function ( ) {
@@ -2066,7 +2072,7 @@ function $ParseProvider() {
2066
2072
}
2067
2073
} ) ;
2068
2074
}
2069
- } , objectEquality ) ;
2075
+ }
2070
2076
}
2071
2077
2072
2078
function oneTimeLiteralWatchDelegate ( scope , listener , objectEquality , parsedExpression ) {
@@ -2076,7 +2082,7 @@ function $ParseProvider() {
2076
2082
} , function oneTimeListener ( value , old , scope ) {
2077
2083
lastValue = value ;
2078
2084
if ( isFunction ( listener ) ) {
2079
- listener . call ( this , value , old , scope ) ;
2085
+ listener ( value , old , scope ) ;
2080
2086
}
2081
2087
if ( isAllDefined ( value ) ) {
2082
2088
scope . $$postDigest ( function ( ) {
@@ -2123,14 +2129,15 @@ function $ParseProvider() {
2123
2129
} ;
2124
2130
2125
2131
// Propagate $$watchDelegates other then inputsWatchDelegate
2132
+ useInputs = ! parsedExpression . inputs ;
2126
2133
if ( parsedExpression . $$watchDelegate &&
2127
2134
parsedExpression . $$watchDelegate !== inputsWatchDelegate ) {
2128
2135
fn . $$watchDelegate = parsedExpression . $$watchDelegate ;
2136
+ fn . inputs = parsedExpression . inputs ;
2129
2137
} else if ( ! interceptorFn . $stateful ) {
2130
2138
// If there is an interceptor, but no watchDelegate then treat the interceptor like
2131
2139
// we treat filters - it is assumed to be a pure function unless flagged with $stateful
2132
2140
fn . $$watchDelegate = inputsWatchDelegate ;
2133
- useInputs = ! parsedExpression . inputs ;
2134
2141
fn . inputs = parsedExpression . inputs ? parsedExpression . inputs : [ parsedExpression ] ;
2135
2142
}
2136
2143
0 commit comments