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

fix($parse): handle interceptors with undefined expressions #13373

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/ng/parse.js
Original file line number Diff line number Diff line change
Expand Up @@ -1775,7 +1775,7 @@ function $ParseProvider() {
return addInterceptor(exp, interceptorFn);

default:
return noop;
return addInterceptor(noop, interceptorFn);
}
};

Expand Down
11 changes: 11 additions & 0 deletions test/ng/parseSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3165,6 +3165,17 @@ describe('parser', function() {
expect(called).toBe(true);
}));

it('should invoke interceptors when the expression is `undefined`', inject(function($parse) {
var called = false;
function interceptor(v) {
called = true;
return v;
}
scope.$watch($parse(undefined, interceptor));
scope.$digest();
expect(called).toBe(true);
}));

it('should treat filters with constant input as constants', inject(function($parse) {
var filterCalls = 0;
$filterProvider.register('foo', valueFn(function(input) {
Expand Down