Error Angularjs 1.6 with uibDatepicker using the template of a component

0

I get the following error with Angularjs 1.6 and with the datepicker of ui-bootstrap:

Error: [$compile:ctreq] Controller 'ngModel',
required by directive 'uibDatepicker', can't be found!

This error appears only when I use the datepicker in a component. If I use it in a directive, it works well. The error jumps when the calendar opens.

Any help? Thanks !!

    
asked by patxiba 22.10.2017 в 00:22
source

1 answer

0

You have to assign the ng-model attribute to the element where you have defined the ubiDatepicker directive.

You probably have something like:

<div ubiDatepicker></div>

To solve the error you have to add the ng-model :

<div ubiDatepicker ng-model="miModelo"></div>

Keep in mind that the documentation says that the model must be an object Date not a string to work.

    
answered by 22.10.2017 в 03:57