我不知道如何恰当地解释它,但我会试一试。
我的应用程序使用: angular (7),jquery-ui,fullcalendar (v3)
this.intervalExTrips = setInterval(this.updateExTrips.bind(this), 10000);
updateExTrips() -对服务器(函数)的异步请求,用于获取日历的外部事件。请求使用return new Promise
在请求之前,我通过添加组件来初始化组件
$(el).draggable({
zIndex: 2,
scroll: false,
appendTo: 'body',
....
})
在执行updateExTrips之后,它将以可拖动的方式飞走。换句话说,可以在调用函数之前移动元素,但不能在执行函数之后移动。
谢谢
发布于 2020-07-24 10:26:38
帮助我ChangeDetectorRef
import {ChangeDetectorRef, Component, OnDestroy, OnInit} from '@angular/core';
constructor(private cd : ChangeDetectorRef)
更新数据后的必要调用
this.http.get<Trip[]>('/trip/')
.subscribe(
...
this.cd.detectChanges();
...
//redraw and add $(el).draggable({
);
https://stackoverflow.com/questions/63056730
复制