From b2dc5c2c7e71d6c17ec0f893282acf99df6154fb Mon Sep 17 00:00:00 2001 From: Tobias Bosch Date: Mon, 26 Oct 2015 13:22:45 -0700 Subject: [PATCH] =?UTF-8?q?fix(compiler):=20create=20literal=20property=20?= =?UTF-8?q?bindings=20for=20empty=20*=E2=80=A6=20directives.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #4916 --- modules/angular2/src/core/compiler/template_parser.ts | 1 + .../test/core/compiler/template_parser_spec.ts | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/modules/angular2/src/core/compiler/template_parser.ts b/modules/angular2/src/core/compiler/template_parser.ts index d1918833a7..107dbe2858 100644 --- a/modules/angular2/src/core/compiler/template_parser.ts +++ b/modules/angular2/src/core/compiler/template_parser.ts @@ -272,6 +272,7 @@ class TemplateParseVisitor implements HtmlAstVisitor { targetMatchableAttrs, targetProps); } else { targetMatchableAttrs.push([dashCaseKey, '']); + this._parseLiteralAttr(dashCaseKey, null, attr.sourceInfo, targetProps); } } return true; diff --git a/modules/angular2/test/core/compiler/template_parser_spec.ts b/modules/angular2/test/core/compiler/template_parser_spec.ts index efa1b8aa44..f00d9ebcc5 100644 --- a/modules/angular2/test/core/compiler/template_parser_spec.ts +++ b/modules/angular2/test/core/compiler/template_parser_spec.ts @@ -670,6 +670,17 @@ There is no directive with "exportAs" set to "dirA" at TestComp > div:nth-child( [ElementAst, 'div', 'TestComp > div:nth-child(0)'] ]); }); + + it('should work with *... and empty value', () => { + expect(humanizeTemplateAsts(parse('
', [ngIf]))) + .toEqual([ + [EmbeddedTemplateAst, 'TestComp > div:nth-child(0)'], + [DirectiveAst, ngIf, 'TestComp > div:nth-child(0)'], + [BoundDirectivePropertyAst, 'ngIf', 'null', 'TestComp > div:nth-child(0)[*ng-if=]'], + [ElementAst, 'div', 'TestComp > div:nth-child(0)'] + ]); + }); + }); });