I have two inputs type="date" to filter the data by period. I would like to bring them with value already informed when loading the page.
First input with value Date() -7.
Second input with Date().
This is my angular code:
<input type="date" class="form-control form-date" [(ngModel)]="dtInitial">
<input type="date" class="form-control form-date" [(ngModel)]="dtFinal">´
Since now, thank you who can help me.
Your input should take in a string. Try to convert the date to a string in the component.
Alternatively, you could also use the datePipe directly in the template. You can format your date in other ways. Here you see some diffferent formats you can use: https://developer.mozilla.org/en-US/docs/Web/HTML/Date_and_time_formats#format_of_a_valid_date_string.
If you want to make the inputs update when one of them is changed you could add this to the component.
and this for the inputs.
That how you could do it - but in general, you should consider if two-binding is the way to go :)