0

我正在使用 Syncfusion Angular 时间表。为标题快速信息添加模板。

标题模板

            <ng-template #quickInfoTemplatesHeader let-data>
                <div *ngIf="data.elementType == 'event'">
                    <div class="e-popup-header" style="background-color: rgb(234, 122, 87);">
                        <div class="e-header-icon-wrapper">
                            <button (click)="onEditClick($event)" class="e-edit e-icons e-control e-btn e-lib e-flat e-round e-small e-icon-btn" title="Edit">
                                <span class="e-btn-icon e-icons e-edit-icon"></span>
                            </button>
                            <button (click)="onDeleteClick($event)" class="e-delete e-icons e-control e-btn e-lib e-flat e-round e-small e-icon-btn" title="Delete">
                                <span class="e-btn-icon e-icons e-delete-icon"></span>
                            </button>
                            <button (click)="onCloseClick($event)" class="e-close e-control e-btn e-lib e-flat e-round e-small e-icon-btn" title="Close">
                                <span class="e-btn-icon e-icons e-close-icon"></span>
                            </button>
                        </div>
                        <div class="e-subject-wrap">
                            <div class="e-subject e-text-ellipsis" [title]="data.Subject"><div [innerHTML]="data.Subject"></div></div>
                        </div>
                    </div>
                </div>
            </ng-template>

当我单击编辑按钮或双击选项卡时,删除一个 js 错误: 无法读取未定义的属性“0”

js错误

这是我点击编辑器的 ts 事件:

public onEditClick(args: any): void {    
    if (this.selectionTarget) {
      let eventData: { [key: string]: Object } = this.scheduleObj.getEventDetails(this.selectionTarget) as { [key: string]: Object };
      let currentAction: CurrentAction = 'Save';
      
      // console.log("TEST", eventData);

      this.scheduleObj.openEditor(eventData, currentAction);
    }
  }

我遵循官方指南:

https://ej2.syncfusion.com/angular/documentation/schedule/editor-template/

4

1 回答 1

0

请在 ng-template 中包含按钮组件ejs-button以解决此问题,如下所示

    <ng-template #quickInfoTemplatesHeader let-data>
    <div *ngIf="data.elementType == 'event'">
        <div class="e-popup-header" style="background-color: rgb(234, 122, 87);">
            <div class="e-header-icon-wrapper">
                <button (click)="onEditClick($event)" ejs-button class="e-edit e-icons e-control e-btn e-lib e-flat e-round e-small e-icon-btn" title="Edit">
          <span class="e-btn-icon e-icons e-edit-icon"></span>
      </button>
                <button (click)="onDeleteClick($event)" ejs-button class="e-delete e-icons e-control e-btn e-lib e-flat e-round e-small e-icon-btn" title="Delete">
          <span class="e-btn-icon e-icons e-delete-icon"></span>
      </button>
                <button (click)="onCloseClick($event)" ejs-button class="e-close e-control e-btn e-lib e-flat e-round e-small e-icon-btn" title="Close">
        <span class="e-btn-icon e-icons e-close-icon"></span>
       </button>
            </div>
            <div class="e-subject-wrap">
                <div class="e-subject e-text-ellipsis" [title]="data.Subject">
                    <div [innerHTML]="data.Subject"></div>
                </div>
            </div>
        </div>
    </div>
</ng-template>

如需更多参考,请参阅以下示例。

https://stackblitz.com/edit/angular-eetjnm?file=app.component.html

于 2020-08-25T14:03:32.860 回答