如何在Angular-Bootstrap ngb-datepicker中设置startDate

时间:2018-08-01 20:08:01

标签: angular datepicker angular6

我想在我的应用程序中使用ngb-datepicker。 According to this documentation,此组件具有一个startDate输入,用于控制日历的初始日期。我不知道如何设置这个日期。由于没有使用此输入的示例,因此我不得不猜测。我已经尝试了所有这些行,但是它们不起作用。

  1. <ngb-datepicker startDate="2018-11-01"></ngb-datepicker>
  2. <ngb-datepicker startDate="{ year: 2018; month: 11; }"></ngb-datepicker>
  3. <ngb-datepicker startDate.year="2018" startDate.month="11"></ngb-datepicker>

我该怎么做?>

1 个答案:

答案 0 :(得分:2)

它们确实在文档中显示了它。在“概述”部分的“四处移动”子句中。就像这样:

<ngb-datepicker [startDate]="{year: 2018, month: 11}"