@@ -1095,6 +1095,7 @@ function $ParseProvider() {
1095
1095
//oneTime is not part of the exp passed to the Parser so we may have to
1096
1096
//wrap the parsedExpression before adding a $$watchDelegate
1097
1097
parsedExpression = wrapSharedExpression ( parsedExpression ) ;
1098
+ parsedExpression . oneTime = true ;
1098
1099
parsedExpression . $$watchDelegate = parsedExpression . literal ?
1099
1100
oneTimeLiteralWatchDelegate : oneTimeWatchDelegate ;
1100
1101
} else if ( parsedExpression . inputs ) {
@@ -1254,13 +1255,19 @@ function $ParseProvider() {
1254
1255
function addInterceptor ( parsedExpression , interceptorFn ) {
1255
1256
if ( ! interceptorFn ) return parsedExpression ;
1256
1257
1257
- var fn = function interceptedExpression ( scope , locals ) {
1258
- var value = parsedExpression ( scope , locals ) ;
1259
- var result = interceptorFn ( value , scope , locals ) ;
1260
- // we only return the interceptor's result if the
1261
- // initial value is defined (for bind-once)
1262
- return isDefined ( value ) || interceptorFn . $stateful ? result : value ;
1263
- } ;
1258
+ var fn ;
1259
+ if ( parsedExpression . oneTime ) {
1260
+ fn = function interceptedOneTimeExpression ( scope , locals ) {
1261
+ var value = parsedExpression ( scope , locals ) ;
1262
+ if ( isDefined ( value ) ) {
1263
+ return interceptorFn ( value , scope , locals ) ;
1264
+ }
1265
+ } ;
1266
+ } else {
1267
+ fn = function interceptedExpression ( scope , locals ) {
1268
+ return interceptorFn ( parsedExpression ( scope , locals ) , scope , locals ) ;
1269
+ } ;
1270
+ }
1264
1271
1265
1272
// Propagate $$watchDelegates other then inputsWatchDelegate
1266
1273
if ( parsedExpression . $$watchDelegate &&
0 commit comments