0
我使用的離子2離子2聊天頁面相同的值被重複
這裏是我的模板代碼
<div class="messagesholder" *ngFor="let chat of chatval | orderby:'[date]'; let last = last">
{{last ? callFunction() : ''}}
<div *ngIf="chat.sender == currentuser || chat.receiver == currentuser">
<p *ngIf="msgdate === undefined" class="chat-date" #ChatDate id="ChatDate" >{{chat.date | amDateFormat:'LL'}}</p>
{{checkdate(chat.date)}}
</div>
<div class="message" *ngIf="chat.sender == currentuser || chat.receiver == currentuser" [ngClass]="{'me': currentuser == chat.sender}">
<div class='image' *ngIf="chat.path" >
<img *ngIf="chat.path" [src]="chat.path" imageViewer/><br>
<span *ngIf="chat.path_text">{{chat.path_text}}</span>
<span style="font-size:9px;">{{chat.date | amDateFormat:'hh:mmA'}}</span>
</div>
<div *ngIf="chat.message_text">
<span>{{chat.message_text}}</span>
<span style="font-size:9px;">{{chat.date | amDateFormat:'hh:mmA'}}</span>
</div>
</div>
</div>
這裏是我的功能
我需要相同的日期值都不要重複。因爲我使用此函數{{checkdate(chat.date)}}得到輸入元素值。
但我越來越這個錯誤。
Error in ./ChatPage class ChatPage - caused by: Expression has changed after it was checked. Previous value: 'true'. Current value: 'false'.
我怎樣才能解決這個問題?
請諮詢我,
感謝
Thanks.I有一個doubt.I使用此功能如何我可以在ng中顯示唯一的日期值嗎 – ANISUNDAR
可以幫我嗎 – ANISUNDAR
你可以在for語句中使用「Values」變量,例如* ngFor =「let item of Values」 –