Skip to content

Commit

Permalink
fix($parse): do not pass scope/locals to interceptors of one-time bin…
Browse files Browse the repository at this point in the history
…dings
  • Loading branch information
jbedard committed Jul 22, 2017
1 parent e6d5fe7 commit 87a586e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/ng/parse.js
Original file line number Diff line number Diff line change
Expand Up @@ -1907,7 +1907,7 @@ function $ParseProvider() {
if (isDone(lastValue)) {
scope.$$postDigest(unwatchIfDone);
}
return post(lastValue, scope, locals);
return post(lastValue);
}
}

Expand Down
14 changes: 14 additions & 0 deletions test/ng/parseSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3246,6 +3246,20 @@ describe('parser', function() {
expect(args).toEqual([1]);
}));

it('should only be passed the intercepted value when wrapping one-time', inject(function($parse) {
var args;
function interceptor(v) {
args = sliceArgs(arguments);
return v;
}

scope.$watch($parse('::a', interceptor));

scope.a = 1;
scope.$digest();
expect(args).toEqual([1]);
}));

it('should only be passed the intercepted value when double-intercepted',
inject(function($parse) {
var args1;
Expand Down

0 comments on commit 87a586e

Please sign in to comment.