填写日期时间本地输入字段

Fill datetime-local input field

我想在我的组件中设置日期时间本地输入字段的值 class 但我无法绑定该值。

我错过了什么?

HTML

<input id="date" type="datetime-local" [(ngModel)]="model.date" class="form-control" />

TS

public model: Model = new Model(-1, "old", new Date(2000, 1,1 ));

这是一个例子Plunker

本地日期时间输入字段没有值 (Chrome 55)

我认为您需要为 this.model.date 使用字符串格式,我更改了您的 plunker,fill fields 现在可以正常工作了。 https://plnkr.co/edit/FpEBvc?p=preview