【发布时间】:2021-11-01 09:53:16
【问题描述】:
我有一项服务,它提取表示为数组 (e.g. [2021, 09, 02, 08, 46] or [yyyy, mm, dd, hh, mm]) 的日期时间
在我的组件中,以下属性存储上面提取的日期时间
public startTime : number[];
在我的模板中,我想将此数组绑定到我的输入,如下所示:
<input type="datetime-local" [ngModel]="startTime" />
有没有一种干净的方法将startTime(表示年/月/日/小时/时间作为数组)绑定到datetime-local?如果不需要的话,我不想做一堆强制转换或转换。
【问题讨论】:
标签: angular typescript binding