diff --git a/modules/@angular/compiler/src/expression_parser/parser.ts b/modules/@angular/compiler/src/expression_parser/parser.ts index d72d1b4213..049c5eeae0 100644 --- a/modules/@angular/compiler/src/expression_parser/parser.ts +++ b/modules/@angular/compiler/src/expression_parser/parser.ts @@ -511,10 +511,15 @@ export class _ParseAST { this.rparensExpected--; this.expectCharacter(chars.$RPAREN); return result; - } else if (this.next.isKeywordNull() || this.next.isKeywordUndefined()) { + + } else if (this.next.isKeywordNull()) { this.advance(); return new LiteralPrimitive(this.span(start), null); + } else if (this.next.isKeywordUndefined()) { + this.advance(); + return new LiteralPrimitive(this.span(start), void 0); + } else if (this.next.isKeywordTrue()) { this.advance(); return new LiteralPrimitive(this.span(start), true); diff --git a/modules/@angular/compiler/test/expression_parser/parser_spec.ts b/modules/@angular/compiler/test/expression_parser/parser_spec.ts index ffd17e4dd1..bbf425ab50 100644 --- a/modules/@angular/compiler/test/expression_parser/parser_spec.ts +++ b/modules/@angular/compiler/test/expression_parser/parser_spec.ts @@ -92,6 +92,8 @@ export function main() { it('should parse null', () => { checkAction('null'); }); + it('should parse undefined', () => { checkAction('undefined'); }); + it('should parse unary - expressions', () => { checkAction('-1', '0 - 1'); checkAction('+1', '1');