一个元素上不能有多个模板绑定。 ngFor和ngIf在一起

时间:2016-12-08 00:11:27

标签: angular ngfor

我正在尝试显示li元素 {{info.email}}仅当localStorage变量匹配时,才能在此设备上使用。我需要在li元素内部,因为此数据来自数据库。任何人都可以阐明如何实现这一目标吗?

<ul>
    <li *ngFor="let info of infos" (click)="personTapped($event, info);" *ngIf="(window.localStorage.getItem('userLoggedIn') === info.email)"> {{info.username}} (USER ON THIS DEVICE) 
    </li>
</ul>

1 个答案:

答案 0 :(得分:0)

正如yurzui所说,你可以这样做:*ngIf and *ngFor on <td></td> element使用HasFile

或使用ng-container代替[hidden]