ng-bootstrap datepicker validity and initial value

守給你的承諾、 提交于 2019-12-24 20:41:46

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!