Search code examples
angulardatepickerangular2-formsng2-bootstrapangular2-formbuilder

Model Driven form with ng2-bootstrap datepicker


I've looked around and wasn't able to find anything definitive on this - can you use the ng2-bootstrap datepicker with an Angular2 model driven form, or does it only work with template forms?

The documentation describes the selector such that you'd use it as follows (as an example):

<datepicker [(ngModel)]="startDate" ></datepicker>

...which does seem to work. Ideally I'd like to use it like this:

<datepicker formControlName="startDate" ></datepicker>

...but it doesn't seem to work that way out of the box. Is there a way to use this module with model driven forms? If not, is there a reasonable alternative that will work with model driven forms? (I've also tried ng2-datepicker but there's an outstanding bug that makes it inconvenient to use with SystemJS, which is unfortunate because it looks slick).


Solution

  • I have used the primeNg set of controls and they have a calendar control with amazing functionality. See it here: PrimeNg Calendar UI Control