Angular2, Datepicker setup

602 views
Skip to first unread message

sri devi

unread,
Jun 13, 2016, 1:55:08 AM6/13/16
to AngularJS

Hi, I need to set Date Selected Mode in Angular2.
Here is My code,

<input type="text" class="form-control date_cursor" id="eDate"  name="empDate"  value="06/11/2016" placeholder="MM/DD/YYYY"/>
<span class="input-group-addon add-on">
    <span class="glyphicon glyphicon-calendar"></span>
</span> (its working) (1.jpg)


<input type="text" class="form-control date_cursor" id="eDate"  name="empDate"  value="{{testDate | date:'MM/dd/yyyy'}}" placeholder="MM/DD/YYYY"/>
<span class="input-group-addon add-on">
    <span class="glyphicon glyphicon-calendar"></span>
</span> (its not working) (2.jpg)



Anyone please help me... In angular2, I need to set "Date" Selected Mode in Datepicker .

sri devi

unread,
Jun 13, 2016, 3:33:21 AM6/13/16
to AngularJS
There is no one willing to answer my question?

Teija Paldanius

unread,
Jun 13, 2016, 4:41:18 AM6/13/16
to AngularJS
Can you test it without formatting the date value?

sri devi

unread,
Jun 13, 2016, 5:15:34 AM6/13/16
to AngularJS
Yes I tried. that is working fine.

Teija Paldanius

unread,
Jun 13, 2016, 5:51:40 AM6/13/16
to AngularJS

You used only variable {{testDate}}? What's the format on the text field then? Does it show a long value or are you using a Date object? Btw localization also formats the date.

Sitharthan Velsamy Kumar

unread,
Jun 13, 2016, 6:04:31 AM6/13/16
to ang...@googlegroups.com
You have used Any plugins for datepicker ?


--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+u...@googlegroups.com.
To post to this group, send email to ang...@googlegroups.com.
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.



--
Thanks & Regards,
Sitharthan V K 

Sitharthan Velsamy Kumar

unread,
Jun 13, 2016, 6:12:08 AM6/13/16
to ang...@googlegroups.com
I already face this problem. Are you using jquery datepicker for that? 

Sitharthan Velsamy Kumar

unread,
Jun 13, 2016, 6:16:20 AM6/13/16
to ang...@googlegroups.com
If you used jquery datePicker use this way,


$('#eDate').datepicker({ format: 'mm/dd/yyyy', autoclose: true, todayHighlight: true, gotoCurrent: true});

Please check it and update here.

sri devi

unread,
Jun 13, 2016, 6:39:54 AM6/13/16
to AngularJS
Hi Sithar, I am using bootstrap datepicker.  I tried Your code but it also not working. :(

Teija Paldanius

unread,
Jun 13, 2016, 8:04:25 AM6/13/16
to AngularJS
Try to use some ready component like angular-strap datepicker if it works in Angular2

Sitharthan Velsamy Kumar

unread,
Jun 14, 2016, 4:07:01 AM6/14/16
to ang...@googlegroups.com
Hi Sri,

Can you please use below codes on your html controller with first step.?!

I think it willbe working for that.

code is,

$('#eDate').datepicker({ format: 'mm/dd/yyyy', autoclose: true, todayHighlight: true, gotoCurrent: true});

On Mon, Jun 13, 2016 at 5:34 PM, Teija Paldanius <teija.p...@gmail.com> wrote:
Try to use some ready component like angular-strap datepicker if it works in Angular2

--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+u...@googlegroups.com.
To post to this group, send email to ang...@googlegroups.com.
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages