在Angular Kendo Grid中,即使有日期,日期引发null异常

时间:2018-10-18 11:37:36

标签: angular kendo-ui-angular2

我正在使用Angular Kendo Grid开发Angular应用程序。我有来自服务器的以下格式的日期。

1900-01-01T00:00:00

并且在Kendo Grid中,我尝试通过以下代码进行格式化,该代码确实有效,但是即使存在日期,也会引发空异常。

网格单元格

<kendo-grid-column field="consultation.closeDate" width="220" title="Consultation Close Date" filter="date">
      <ng-template kendoGridCellTemplate let-dataItem>
          <span *ngIf="dataItem.consultation.closeDate">{{dataItem.consultation.closeDate | date: "longDate" }}</span>
      </ng-template>  
  </kendo-grid-column>

错误

ERROR TypeError: Cannot read property 'closeDate' of null
at Object.eval [as updateRenderer] (UserRoleManagementComponent.html:114)
at Object.debugUpdateRenderer [as updateRenderer] (core.js:14378)
at checkAndUpdateView (core.js:13514)
at callViewAction (core.js:13859)
at execEmbeddedViewsAction (core.js:13817)
at checkAndUpdateView (core.js:13510)
at callViewAction (core.js:13859)
at execEmbeddedViewsAction (core.js:13817)
at checkAndUpdateView (core.js:13510)
at callViewAction (core.js:13859)

0 个答案:

没有答案