Having the file app.component.ts
, inside its class it is declared a variable of which stores from the input a date.
I want with that date to create an object, the key being the date and the value being a boolean ( which is true or false depending on the date, for example if the date is inside year 2018 it is false, otherwise it's true)
Html file:
<input type="date" [(ngModel)]="currentDate">
<button (click)="addDate()">add date</button>
ts:
export class AppComponent {
dateArray = [];
currentDate = "";
dateObject = { this.currentDate, true };
addDate() {
this.dateArray.push(dateObject);
}
}
I'm new to Angular, I don't know how dateObject
should look like in order to store in it what I want. Any suggestions?