Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 7730530

Browse files
committed
fixup! fix($parse): always pass the intercepted value to watchers
1 parent a57687b commit 7730530

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

src/ng/parse.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1962,7 +1962,7 @@ function $ParseProvider() {
19621962
// to ensure the original parsedExpression is always the $$intercepted
19631963
if (parsedExpression.$$interceptor) {
19641964
interceptorFn = chainInterceptors(parsedExpression.$$interceptor, interceptorFn);
1965-
parsedExpression = parsedExpression.$$intercepted || parsedExpression;
1965+
parsedExpression = parsedExpression.$$intercepted;
19661966
}
19671967

19681968
var useInputs = false;

test/ng/parseSpec.js

+16
Original file line numberDiff line numberDiff line change
@@ -3448,6 +3448,22 @@ describe('parser', function() {
34483448
expect(log.empty()).toEqual([]);
34493449
}));
34503450

3451+
it('should watch the intercepted value of one-time bindings in nested interceptors', inject(function($parse, log) {
3452+
scope.$watch($parse($parse('::{x:x, y:y}', function(lit) { return lit.x; }), identity), log);
3453+
3454+
scope.$apply();
3455+
expect(log.empty()).toEqual([undefined]);
3456+
3457+
scope.$apply('x = 1');
3458+
expect(log.empty()).toEqual([1]);
3459+
3460+
scope.$apply('x = 2; y=1');
3461+
expect(log.empty()).toEqual([2]);
3462+
3463+
scope.$apply('x = 1; y=2');
3464+
expect(log.empty()).toEqual([]);
3465+
}));
3466+
34513467
it('should nest interceptors around eachother, not around the intercepted', inject(function($parse) {
34523468
function origin() { return 0; }
34533469

0 commit comments

Comments
 (0)