Re: [angular.js] using bootstrap datepicker

9,090 views
Skip to first unread message

Peter Bacon Darwin

unread,
Jul 1, 2012, 4:20:59 PM7/1/12
to ang...@googlegroups.com
Have a look at how I did it with the JQuery date picker.  It might help.
https://github.com/petebacondarwin/angular-ui/tree/angular-v1.0/modules/directives/date 
Pete

On 1 July 2012 08:20, Novi Border <novib...@gmail.com> wrote:
Hi,

I am trying to use nice bootstrap datepicker from http://www.eyecon.ro/bootstrap-datepicker/ with angular,
but I don't know how to integrate it properly.

I have made a jsfiddle with a sample at http://jsfiddle.net/T37db/3/

In the example there are three datepickers. First an input without angular, than input with angular, an last span with angular.

In the input with angular part date filter is not working properly in the jsfiddle though it works ok for me locally..

I have made starting directive (b-datepicker) which initializes datepicker. I am stuck with how to handle change event (or hide) from datepicker (as shown on the first example) to update the model (how to access model from directive), and how/when to properly call digest..

Can someone give me some pointers?
TIA
NB

--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To view this discussion on the web visit https://groups.google.com/d/msg/angular/-/QXNvc__FVHgJ.
To post to this group, send email to ang...@googlegroups.com.
To unsubscribe from this group, send email to angular+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/angular?hl=en.

poli...@gmail.com

unread,
Jul 6, 2012, 11:45:47 AM7/6/12
to ang...@googlegroups.com
Hi Novi,
will you please share your solution.

thanks,
Gerry

andr...@lime-square.net

unread,
Jul 18, 2012, 5:11:15 AM7/18/12
to ang...@googlegroups.com
Hi,

I've modified Novi's solution into something that works for me:

Andries

On Monday, July 16, 2012 6:57:32 PM UTC+2, Uri Goldshtein wrote:
Hi!

  Very nice and thanks a lot.

   Couple of things i'm trying to fix, maybe you have an idea:

   1. If i want to change the format to 'dd-mm-yy' it will result in invalid date  (http://jsfiddle.net/Urigo/XWPGB/)
   2. In the JQuery date picker, after you select a date, the field gets out of focus. that is good if you want to change the date again without having to press outside of the field and back on it again.  i've added        element.blur();   in the end of  datePickerSettings.onSelect and that worked great for me. maybe you'll like that also.

By the way, i'm using it together with custom date range filter between two dates to filter pins on google maps, if anyone is interested in something similar.

Great job!

On Friday, July 13, 2012 11:22:38 AM UTC+3, Novi Border wrote:
Hi,

this is just a basic proof of concept code but it work good enough for me, maybe you will find it usefull..

https://gist.github.com/3103533

tkro...@gmail.com

unread,
Sep 23, 2012, 6:23:56 PM9/23/12
to ang...@googlegroups.com, andr...@lime-square.net
Could someone make a pull request of this to angular-ui?
Reply all
Reply to author
Forward
0 new messages