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

Commit 362d11b

Browse files
fix($parse): allow arguments to contain filter chains
Thanks to @esarbanis for the original PR that got out-dated due to the big $parse overhaul. Closes #4175 Closes #4168 Closes #14720
1 parent b9ac336 commit 362d11b

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/ng/parse.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,7 @@ AST.prototype = {
545545
var args = [];
546546
if (this.peekToken().text !== ')') {
547547
do {
548-
args.push(this.expression());
548+
args.push(this.filterChain());
549549
} while (this.expect(','));
550550
}
551551
return args;

test/ng/parseSpec.js

+9
Original file line numberDiff line numberDiff line change
@@ -2139,6 +2139,15 @@ describe('parser', function() {
21392139
expect(scope.$eval("add(1,2)")).toEqual(3);
21402140
});
21412141

2142+
it('should allow filter chains as arguments', function() {
2143+
scope.concat = function(a, b) {
2144+
return a + b;
2145+
};
2146+
scope.begin = 1;
2147+
scope.limit = 2;
2148+
expect(scope.$eval("concat('abcd'|limitTo:limit:begin,'abcd'|limitTo:2:1|uppercase)")).toEqual("bcBC");
2149+
});
2150+
21422151
it('should evaluate function call from a return value', function() {
21432152
scope.getter = function() { return function() { return 33; }; };
21442153
expect(scope.$eval("getter()()")).toBe(33);

0 commit comments

Comments
 (0)