X Tutup
Skip to content

Commit b2dc5c2

Browse files
committed
fix(compiler): create literal property bindings for empty *… directives.
Closes #4916
1 parent 2957b0b commit b2dc5c2

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

modules/angular2/src/core/compiler/template_parser.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,7 @@ class TemplateParseVisitor implements HtmlAstVisitor {
272272
targetMatchableAttrs, targetProps);
273273
} else {
274274
targetMatchableAttrs.push([dashCaseKey, '']);
275+
this._parseLiteralAttr(dashCaseKey, null, attr.sourceInfo, targetProps);
275276
}
276277
}
277278
return true;

modules/angular2/test/core/compiler/template_parser_spec.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -670,6 +670,17 @@ There is no directive with "exportAs" set to "dirA" at TestComp > div:nth-child(
670670
[ElementAst, 'div', 'TestComp > div:nth-child(0)']
671671
]);
672672
});
673+
674+
it('should work with *... and empty value', () => {
675+
expect(humanizeTemplateAsts(parse('<div *ng-if>', [ngIf])))
676+
.toEqual([
677+
[EmbeddedTemplateAst, 'TestComp > div:nth-child(0)'],
678+
[DirectiveAst, ngIf, 'TestComp > div:nth-child(0)'],
679+
[BoundDirectivePropertyAst, 'ngIf', 'null', 'TestComp > div:nth-child(0)[*ng-if=]'],
680+
[ElementAst, 'div', 'TestComp > div:nth-child(0)']
681+
]);
682+
});
683+
673684
});
674685

675686
});

0 commit comments

Comments
 (0)
X Tutup