datepicker under ng-repeat does not work.

3,323 views
Skip to first unread message

Mauro Sanna

unread,
May 28, 2013, 6:59:05 AM5/28/13
to ang...@googlegroups.com
Hello.
I have an input field under ng-repeat:

 <li ng-repeat='f in formFields'>
    <input id="{{f.name}}" name="{{f.name}}" class="date" size="16" type="text" data-date-format="dd/mm/yyyy"/
>

I have the class="date" so when I click the field shows a datepicker to select a date.
Under ng-repeat it seems does not work.
If I put the input field out of ng-repeat it works.
Any help?

Mauro

unread,
May 28, 2013, 4:31:50 PM5/28/13
to angular
I have to use angular-ui or http://mgcrea.github.io/angular-strap/

Sebastian Sebald

unread,
May 28, 2013, 5:00:22 PM5/28/13
to ang...@googlegroups.com
Can you please make a plunk with your custom directive? Otherwise we can not help you :-)

Mauro

unread,
May 28, 2013, 5:57:12 PM5/28/13
to angular
Sorry for my ignorance but to use the datepicker I need a custom directive?
I've installed bootstrap in my application.
In my forms I have some input text fields with a class="datepicker" and in the js $(".datepicker).datepicker().
It works in all my forms but if i put the input text field under a <li ng-repeat=......... > I can't show the datepicker.
Why?


On 28 May 2013 23:00, Sebastian Sebald <sebastia...@gmail.com> wrote:
Can you please make a plunk with your custom directive? Otherwise we can not help you :-)

--
You received this message because you are subscribed to a topic in the Google Groups "AngularJS" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/angular/zoKmf37jrjc/unsubscribe?hl=en-US.
To unsubscribe from this group and all its topics, send an email to angular+u...@googlegroups.com.
To post to this group, send email to ang...@googlegroups.com.
Visit this group at http://groups.google.com/group/angular?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.



Sebastian Sebald

unread,
May 29, 2013, 3:05:46 AM5/29/13
to ang...@googlegroups.com
You shoule never ever ever use a jQuery plugin with AngularJS. That just doesn't work.
What you should do is wrapping the plugin inside a directive (see AngularUI for that, they have a directive for that IMHO). The datepicker should work with ng-repeat then.

Mauro

unread,
May 29, 2013, 3:33:47 AM5/29/13
to angular
Ok, then I've downloaded angularStrap from http://mgcrea.github.io/angular-strap/, I already have bootstrap-datepicker.js and bootstrap-datepicker.css as requested, but datepicker with angular still does not work.

Sebastian Sebald

unread,
May 29, 2013, 3:43:38 AM5/29/13
to ang...@googlegroups.com
Make a plunk/fiddle otherwhise I can not help you.

Mauro

unread,
May 29, 2013, 6:55:36 AM5/29/13
to angular
Solved using grails angularjs plugin.

Mason Jones

unread,
May 29, 2013, 11:59:09 AM5/29/13
to ang...@googlegroups.com
In case it helps, I just wrote up yesterday a short blog post about using the bootstrap-datepicker widget with AngularJS: http://masonoise.wordpress.com/2013/05/28/bootstrap-datetimepicker-with-angularjs/

I'm actually using it inside an ng-repeat with dynamic add/remove buttons and it works nicely.

Joey

unread,
Jun 18, 2019, 10:41:22 AM6/18/19
to Angular and AngularJS discussion
Can you please share your code, i also want to do the same in my working module
Reply all
Reply to author
Forward
0 new messages