bootstrap icon indicating copy to clipboard operation
bootstrap copied to clipboard

Datepicker not working in ng-repeats

Open cgarvis opened this issue 12 years ago • 8 comments

Example plunker: http://plnkr.co/edit/MQzUiooc7mojBH5ivuNC?p=info

Looks like it could be related to other posts: #1381 #2253 #1138

cgarvis avatar Jun 23 '14 22:06 cgarvis

I have the same issue. Date format errors in console occurs.

antonchaika avatar Jun 24 '14 14:06 antonchaika

Trace from console:

TypeError: Cannot read property 'split' of undefined
    at createParser (http://angular-ui.github.io/bootstrap/ui-bootstrap-tpls-0.11.0.min.js:8:9978)
    at parse (http://angular-ui.github.io/bootstrap/ui-bootstrap-tpls-0.11.0.min.js:8:10381)
    at m (http://angular-ui.github.io/bootstrap/ui-bootstrap-tpls-0.11.0.min.js:8:20388)
    at k.$render (http://angular-ui.github.io/bootstrap/ui-bootstrap-tpls-0.11.0.min.js:8:21812)
    at Object.<anonymous> (https://ajax.googleapis.com/ajax/libs/angularjs/1.2.17/angular.min.js:187:45)
    at h.$digest (https://ajax.googleapis.com/ajax/libs/angularjs/1.2.17/angular.min.js:108:321)
    at h.$apply (https://ajax.googleapis.com/ajax/libs/angularjs/1.2.17/angular.min.js:111:451)
    at https://ajax.googleapis.com/ajax/libs/angularjs/1.2.17/angular.min.js:18:303
    at Object.d [as invoke] (https://ajax.googleapis.com/ajax/libs/angularjs/1.2.17/angular.min.js:34:479)
    at c (https://ajax.googleapis.com/ajax/libs/angularjs/1.2.17/angular.min.js:18:211)

I dug into this a little and it seems that the format used in parse/createParser is null instead of the default.

cgarvis avatar Jun 24 '14 15:06 cgarvis

Hi, I also get this issue, but outside without ng-repeat, and when setting init-date, when the model is empty.

Same it seems the dateFormat is undefined whent the parser runs...

ghost avatar Jul 02 '14 13:07 ghost

@cgarvis Here I've modified your plunk that datepicker with ng-repeat works fine

http://plnkr.co/edit/wiMKB3EiXIaDuv84CLHH?p=preview

andrewdacenko avatar Jul 09 '14 12:07 andrewdacenko

@andrewdacenko so the change that you made that makes this work is setting the datapicker-popup format and converted the date strings to Date objects?

cgarvis avatar Jul 09 '14 14:07 cgarvis

@cgarvis main changes are in converting dates into Date objects (required for datepickers), format is an option. Also without $event argument in open function example won't work, so you need $event.preventDafault() and $event.stopPropagation()

andrewdacenko avatar Jul 09 '14 15:07 andrewdacenko

This appears to not be an issue - we currently only support date objects.

Anyhow, this is not an issue with ng-repeat and the datepicker.

wesleycho avatar Mar 24 '15 14:03 wesleycho

@andrewdacenko Thanks a lot :+1:

RajKharva avatar Jun 13 '16 17:06 RajKharva