diff --git a/modules/@angular/compiler/src/template_parser/template_parser.ts b/modules/@angular/compiler/src/template_parser/template_parser.ts index c5e0c08f32..78e8f3f1f2 100644 --- a/modules/@angular/compiler/src/template_parser/template_parser.ts +++ b/modules/@angular/compiler/src/template_parser/template_parser.ts @@ -276,7 +276,7 @@ class TemplateParseVisitor implements html.Visitor { templateBindingsSource = attr.value; } else if (normalizedName.startsWith(TEMPLATE_ATTR_PREFIX)) { templateBindingsSource = attr.value; - prefixToken = normalizedName.substring(TEMPLATE_ATTR_PREFIX.length); + prefixToken = normalizedName.substring(TEMPLATE_ATTR_PREFIX.length) + ':'; } const hasTemplateBinding = isPresent(templateBindingsSource); diff --git a/modules/@angular/compiler/test/template_parser/template_parser_spec.ts b/modules/@angular/compiler/test/template_parser/template_parser_spec.ts index 9ef6fe4818..15541a87d5 100644 --- a/modules/@angular/compiler/test/template_parser/template_parser_spec.ts +++ b/modules/@angular/compiler/test/template_parser/template_parser_spec.ts @@ -1323,17 +1323,30 @@ Reference "#a" is defined several times ("
]#a>
}); + it('should work with *... and use the attribute name as property binding name', () => { expect(humanizeTplAst(parse('
', [ngIf]))).toEqual([ - [EmbeddedTemplateAst], [DirectiveAst, ngIf], - [BoundDirectivePropertyAst, 'ngIf', 'test'], [ElementAst, 'div'] + [EmbeddedTemplateAst], + [DirectiveAst, ngIf], + [BoundDirectivePropertyAst, 'ngIf', 'test'], + [ElementAst, 'div'], + ]); + + // https://github.com/angular/angular/issues/13800 + expect(humanizeTplAst(parse('
', [ngIf]))).toEqual([ + [EmbeddedTemplateAst], + [DirectiveAst, ngIf], + [BoundDirectivePropertyAst, 'ngIf', '0 - 1'], + [ElementAst, 'div'], ]); }); it('should work with *... and empty value', () => { expect(humanizeTplAst(parse('
', [ngIf]))).toEqual([ - [EmbeddedTemplateAst], [DirectiveAst, ngIf], - [BoundDirectivePropertyAst, 'ngIf', 'null'], [ElementAst, 'div'] + [EmbeddedTemplateAst], + [DirectiveAst, ngIf], + [BoundDirectivePropertyAst, 'ngIf', 'null'], + [ElementAst, 'div'], ]); }); });