My code seems to only be working for the 'title' element, while the 'docdatetime' control remains blank. Can anyone spot what I'm doing wrong?
//template ===================================================
<div class="form-group">
<input type="text" id="title" formControlName="title" class="form-control">
</div>
<div class="form-group">
<input type="datetime-local" id="docdatetime" formControlName="docdatetime" class="form-control">
</div>
//component.ts ===============================================
import { FormGroup, FormControl } from '@angular/forms';
.....
export class.....
docForm: FormGroup;
ngOnInit() {
let docTitle = 'My first document';
let docDate = 'Jun 15, 2015, 9:43:11 PM';
this.docForm = new FormGroup({
'title': new FormControl(docTitle),
'docdatetime': new FormControl(new Date(docDate))
});
}