Skip to content

Commit 6b26509

Browse files
committed
fix(parser): parse pipes in template bindings
1 parent 85abfa9 commit 6b26509

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

modules/angular2/src/change_detection/parser/parser.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@ class _ParseAST {
509509
}
510510
} else if (!this.peekKeywordVar()) {
511511
var start = this.inputIndex;
512-
var ast = this.parseExpression();
512+
var ast = this.parsePipe();
513513
var source = this.input.substring(start, this.inputIndex);
514514
expression = new ASTWithSource(ast, source, this.location);
515515
}

modules/angular2/test/change_detection/parser/parser_spec.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -525,6 +525,12 @@ export function main() {
525525
bindings = parseTemplateBindings("directive: var item in expr; var a = b", 'location');
526526
expect(keyValues(bindings)).toEqual(['directive', '#item=\$implicit', 'in=expr in location', '#a=b']);
527527
});
528+
529+
it('should parse pipes', () => {
530+
var bindings = parseTemplateBindings('key value|pipe');
531+
var ast = bindings[0].expression.ast
532+
expect(ast).toBeAnInstanceOf(Pipe);
533+
});
528534
});
529535

530536
describe('parseInterpolation', () => {

0 commit comments

Comments
 (0)