[英]How to refresh <div> content faster on button click in angular?
我有一個具有一定價值的內容,單擊取消按鈕時,我需要刷新它並顯示新內容。 當我單擊取消按鈕時,舊內容會保留幾秒鍾,然后再更改為新內容。請告訴我如何更快地加載新內容而不會出現這種延遲。
<div>Text</div>
<button type="button" class="left-btn pull-right" (click)="reload()" data-dismiss="modal">cancel</button>
reload() {
this.CommonService.GetDateTimeByTimeZone().subscribe(tz => {
let ds: Input = {
StartDate: moment(this.timezoneDate).format("YYYY-MM-DDT00:00:00.000[Z]"),
EndDate: moment(this.timezoneDate).format("YYYY-MM-DDT23:59:59.999[Z]")
}
this.Dashboard(ds, false)
}, error => {
Swal.fire('', this.es.adminErrorMsgList[39].message, 'error')
});
this.SelectedDate = ' ';
}
您實際上可以嘗試在點擊時重新加載數據
reload() {
// do the reload here
this.CommonService.GetDateTimeByTimeZone().subscribe(tz => {
let ds: Input = {
StartDate: moment(this.timezoneDate).format("YYYY-MM-DDT00:00:00.000[Z]"),
EndDate: moment(this.timezoneDate).format("YYYY-MM-DDT23:59:59.999[Z]")
}
this.Dashboard(ds, false)
}, error => {
Swal.fire('', this.es.adminErrorMsgList[39].message, 'error')
});
this.SelectedDate = ' ';
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.