【问题标题】:DayPilot Angular 8 Scheduler Error: The placeholder element not found when refreshDayPilot Angular 8调度程序错误:刷新时找不到占位符元素
【发布时间】:2020-04-19 16:58:06
【问题描述】:

我使用的是 Angular 8 DayPilot 调度程序 并且从链接重定向时可以很好地显示调度表,但是如果直接输入URL或刷新当前调度页面,调度表会消失并报错:

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 行:

<daypilot-scheduler [config]="config" [events]="events" #scheduler></daypilot-scheduler>

【问题讨论】:

    标签: angular daypilot


    【解决方案1】:

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

    html

    <div *ngIf="_reload">
    <daypilot-scheduler [config]="config" [events]="events" #scheduler></daypilot-scheduler>
    </div>
    

    ts

    export class SchedulerComponent implements AfterViewInit{
    _reload = true;
    
      constructor() {}
    
      private reload() {
        setTimeout(() => (this._reload = false));
        setTimeout(() => (this._reload = true));
      }
    
      public ngAfterViewInit(): void {
        this.reload();
      }
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-06-08
      • 2013-08-09
      • 1970-01-01
      • 2020-08-19
      • 1970-01-01
      • 2021-02-02
      • 1970-01-01
      相关资源
      最近更新 更多