I would like to set a specific Date programatically for my control with Angular2, but no matter how I try it, the input always displays "yyyy. mm. dd." in my browser.
Here's my code: HTML:
<input class="form-control" type="date" [(ngModel)]="dateFrom" name="dateFrom" min="2016-10-01" [value]="2016-10-01" />
Typescript
public dateFrom: Date;
constructor() {
}
ngOnInit() {
this.dateFrom = new Date(Date.parse("2016-10-01"));
}
Please note that min="date" and [value]="date" also didn't work in pure HTML code. Is there something I'm missing or it is a really bad idea, to set an input's value from code?