首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >DayPilot Angular 8调度器错误:刷新时找不到占位符元素

DayPilot Angular 8调度器错误:刷新时找不到占位符元素
EN

Stack Overflow用户
提问于 2019-12-31 12:03:45
回答 1查看 122关注 0票数 0

我使用的是Angular 8URL调度器,当从链接重定向时,它能够很好地显示调度器图表,但如果直接输入DayPilot或刷新当前调度器页面,调度器图表将消失,并将命中错误:

代码语言:javascript
复制
SchedulerComponent.html:1 ERROR Error: DayPilot.Scheduler: The placeholder element not found: 'dp_157775431314089808'.
    at viewWrappedDebugError (core.js:19411)
    at callWithDebugContext (core.js:30049)
    at Object.debugCheckAndUpdateView [as checkAndUpdateView] (core.js:29741)
    at ViewRef_.push../node_modules/@angular/core/fesm5/core.js.ViewRef_.detectChanges (core.js:20458)
    at ApplicationRef.push../node_modules/@angular/core/fesm5/core.js.ApplicationRef.tick (core.js:26837)
    at core.js:26726
    at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke (zone.js:391)
    at Object.onInvoke (core.js:25986)
    at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke (zone.js:390)
    at Zone.push../node_modules/zone.js/dist/zone.js.Zone.run (zone.js:150)

我的SchedulerComponent.html代码行1:

代码语言:javascript
复制
<daypilot-scheduler [config]="config" [events]="events" #scheduler></daypilot-scheduler>
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-02-03 16:21:47

我能够通过应用下面的替代解决方案来修复它:刷新页面时强制重新呈现组件,尽管控制台错误仍然存在,但至少现在可以使用调度程序

html

代码语言:javascript
复制
<div *ngIf="_reload">
<daypilot-scheduler [config]="config" [events]="events" #scheduler></daypilot-scheduler>
</div>

ts

代码语言:javascript
复制
export class SchedulerComponent implements AfterViewInit{
_reload = true;

  constructor() {}

  private reload() {
    setTimeout(() => (this._reload = false));
    setTimeout(() => (this._reload = true));
  }

  public ngAfterViewInit(): void {
    this.reload();
  }
}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/59539427

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档