我想在角度2.0中动态添加一个按钮。我目前正在关注此事
它要求参数,我将其更改为TemplateRef<any>
。但是我得到了像
Unhandled Promise rejection: Template parse errors:
Parser Error: Unexpected token # at column 7 in `[ngFor #detail of details] in TabComponent@5:14 ("
You have {{details.length}} details.
</template>
<template [ERROR ->]*ngFor="#detail of details" ui-pane [title]="detail.title">
{{detail.text}}
<br>
"): TabComponent@5:14
Parser Error: Unexpected token # at column 7 in [ngFor #detail of details] in TabComponent@5:14 ("ave {{details.length}} details.
</template>
<template *ngFor="#detail of details" ui-pane [ERROR ->][title]="detail.title">
{{detail.text}}
<br>
"): TabComponent@5:50
Parser Error: Unexpected token # at column 7 in [ngFor #detail of details] in TabComponent@5:14 ("details.
</template>
<template *ngFor="#detail of details" ui-pane [title]="detail.title">[ERROR ->]
{{detail.text}}
<br>
"): TabComponent@5:73
Parser Error: Unexpected token # at column 7 in [ngFor #detail of details] in TabComponent@5:14 ("
<br>
<br>
<button class="btn" [ERROR ->](click)="removeDetail(detail)">Remove</button>
</template>
<template ui-pane title='Summary"): TabComponent@9:28
Can't bind to 'ngFor' since it isn't a known property of 'template'. ("
You have {{details.length}} details.
</template>
<template [ERROR ->]*ngFor="#detail of details" ui-pane [title]="detail.title">
{{detail.text}}
<br>
"): TabComponent@5:14
Property binding ngFor not used by any directive on an embedded template. Make sure that the property name is spelled correctly and all directives are listed in the "directives" section. ("
You have {{details.length}} details.
</template>
请告诉我将<any>
类型传递给TemplateRef
或在此处需要更改的内容是否有任何问题。
也欢迎任何其他动态添加标签的代码。