我正在使用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)