我想在angularjs2使用ngFor訪問局部變量在HTML模板,下面使用* ngFor在Angular2
<a *ngFor="#facet of facet_data" class="collection-item" (click)="setToSearchBarWithFilter(facet.category)">
{{facet.category}}<span class="badge">{{facet.count}}</span>
</a>
我想申請* ngIf在錨標記,只顯示那些具有標籤示例代碼facet.count> 0,這樣的事情:
<a *ngFor="#facet of facet_data" class="collection-item" (click)="setToSearchBarWithFilter(facet.category)" *ngIf="facet.count > 0">
{{facet.category}}<span class="badge">{{facet.count}}</span>
</a>
但方面是不具備的錨標記,它只是在<a>
標籤內的模板可用,我怎麼能達到同樣的,該如何解決。