我有2个标签
那么,任何人都可以帮我解决这个问题.. 即使我在关闭的标签中没有对话,它也必须显示空字段,如果我更改标签,它也必须正常工作。
HTML:
spell_window.mainloop()
TS:
<ul>
<li *ngFor="let reply of message_close.messages">
<img [src]="reply.from_user_image || '../assets/images/msg.png'"/>
<p><b>{{reply.name}} </b> <span> {{reply.updated_at | date:'dd.MM.yyyy'}} - {{reply.updated_at | date:'h:mm'}}</span></p>
<p>{{reply.text}}</p>
</li>
</ul>
答案 0 :(得分:1)
你可以使用ngIf,
来做到这一点 <ul>
<li *ngIf="message_close == undefined || message_close.messages.length == 0|| message_close.messages.length == undefined">
<p>there is no closed messages.</p>
</li>
<li *ngFor="let reply of message_close.messages" >
<img [src]="reply.from_user_image || '../assets/images/msg.png'"/>
<p><b>{{reply.name}} </b> <span> {{reply.updated_at | date:'dd.MM.yyyy'}} - {{reply.updated_at | date:'h:mm'}}</span></p>
<p>{{reply.text}}</p>
</li>
</ul>