【发布时间】:2019-08-04 00:03:41
【问题描述】:
我的代码出现 angular 6 错误
<span *ngFor="let tag of item.payload.doc.data().TAGS" >
<button class="nav-link active" (click)="searchByTags('{{tag}}')" >{{tag}},</button>
</span>
我想在 searchByTags 函数中加入动态 {{tag}} 但它给了我下一个错误:
Parser Error: Got interpolation ({{}}) where expression was expected at column 14 in [searchByTags('{{tag}}')] in ng:///AppModule/HomeComponent.html@76:56 ("et tag of item.payload.doc.data().TAGS" >
<button class="nav-link active" [ERROR ->](click)="searchByTags('{{tag}}')" >{{tag}},</button>
</span>
【问题讨论】:
-
把这个
(click)="searchByTags('{{tag}}')"改成这个(click)="searchByTags(tag)"
标签: angular