问题
using the datepicker component in a template-driven form like so:
<input
class="form-control"
placeholder="dd-mm-yyyy"
ngbDatepicker
#from="ngbDatepicker"
(click)="from.toggle()"
[(ngModel)]="params.from"
name="from"
required
/>
how would I go about getting the validity? {{from.invalid}}
doesn't return anything.
Also, how would I set the initial state? tried:
new Date()
{
year: 2017,
month: 10,
day: 20
}
Simple string like 2017-10-20
and 20-10-2017
(matching my format).
来源:https://stackoverflow.com/questions/46693926/ng-bootstrap-datepicker-validity-and-initial-value