How disable all the dates before a particular date in angular?

前端 未结 6 625
清酒与你
清酒与你 2021-02-07 20:32

I am building a component (html, css, spec.ts, ts) in angular in which I always want endDate > startDate. I have followed this link https://material.angular.io/components/datepi

6条回答
  •  萌比男神i
    2021-02-07 21:02

    Unless I'm missing something, you can use the [min]="" date property:

    Whatever startDate is will limit the Calendar dates available for endDate. If you need it set before startDate is chosen, use another variable and set it in consturctor() or ngOnInit() of your component.

    See: https://material.angular.io/components/datepicker/overview#date-validation

提交回复
热议问题