I am using the ng2-datepicker in my angular app and I want to update the date from the typescript file.
In the html template:
<ng2-datepicker [options]="optionsForMenuDate" [(ngModel)]="selectedDate" name="selectedDate"></ng2-datepicker>
It is binding to a moment object, so I am trying to update it like this (I have included moment in the angular solution):
this.selectedDate = this.moment(date);
Where date it the js Date object that I want to set the date to. This just sets the component to null though, even this this.selectedDate is not null.
console.log(this.selectedDate); // logs a moment object
Any ideas on how to achieve this?