From 6b2650996c45e92c9987dc4fb71281c5923386e0 Mon Sep 17 00:00:00 2001 From: vsavkin Date: Mon, 23 Feb 2015 13:12:49 -0800 Subject: [PATCH] fix(parser): parse pipes in template bindings --- modules/angular2/src/change_detection/parser/parser.js | 2 +- .../angular2/test/change_detection/parser/parser_spec.js | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/modules/angular2/src/change_detection/parser/parser.js b/modules/angular2/src/change_detection/parser/parser.js index 66d2f8423c..09ade4da04 100644 --- a/modules/angular2/src/change_detection/parser/parser.js +++ b/modules/angular2/src/change_detection/parser/parser.js @@ -509,7 +509,7 @@ class _ParseAST { } } else if (!this.peekKeywordVar()) { var start = this.inputIndex; - var ast = this.parseExpression(); + var ast = this.parsePipe(); var source = this.input.substring(start, this.inputIndex); expression = new ASTWithSource(ast, source, this.location); } diff --git a/modules/angular2/test/change_detection/parser/parser_spec.js b/modules/angular2/test/change_detection/parser/parser_spec.js index 19e43ae7b9..0ace2d67e4 100644 --- a/modules/angular2/test/change_detection/parser/parser_spec.js +++ b/modules/angular2/test/change_detection/parser/parser_spec.js @@ -525,6 +525,12 @@ export function main() { bindings = parseTemplateBindings("directive: var item in expr; var a = b", 'location'); expect(keyValues(bindings)).toEqual(['directive', '#item=\$implicit', 'in=expr in location', '#a=b']); }); + + it('should parse pipes', () => { + var bindings = parseTemplateBindings('key value|pipe'); + var ast = bindings[0].expression.ast + expect(ast).toBeAnInstanceOf(Pipe); + }); }); describe('parseInterpolation', () => {