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

Commit 87a586e

Browse files
committed
fix($parse): do not pass scope/locals to interceptors of one-time bindings
1 parent e6d5fe7 commit 87a586e

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

src/ng/parse.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1907,7 +1907,7 @@ function $ParseProvider() {
19071907
if (isDone(lastValue)) {
19081908
scope.$$postDigest(unwatchIfDone);
19091909
}
1910-
return post(lastValue, scope, locals);
1910+
return post(lastValue);
19111911
}
19121912
}
19131913

test/ng/parseSpec.js

+14
Original file line numberDiff line numberDiff line change
@@ -3246,6 +3246,20 @@ describe('parser', function() {
32463246
expect(args).toEqual([1]);
32473247
}));
32483248

3249+
it('should only be passed the intercepted value when wrapping one-time', inject(function($parse) {
3250+
var args;
3251+
function interceptor(v) {
3252+
args = sliceArgs(arguments);
3253+
return v;
3254+
}
3255+
3256+
scope.$watch($parse('::a', interceptor));
3257+
3258+
scope.a = 1;
3259+
scope.$digest();
3260+
expect(args).toEqual([1]);
3261+
}));
3262+
32493263
it('should only be passed the intercepted value when double-intercepted',
32503264
inject(function($parse) {
32513265
var args1;

0 commit comments

Comments
 (0)