This is a migrated thread and some comments may be shown as answers.

how to set initial value for date-time-picker when using Angular

3 Answers 590 Views
Date/Time Pickers
This is a migrated thread and some comments may be shown as answers.
Allan
Top achievements
Rank 1
Allan asked on 30 Dec 2016, 04:06 PM

Hi,

I am trying to set an initial value of the kendo date time picker using the k-value attribute but it does not work for me:

        <input kendo-date-time-picker
               ng-model="str"
               k-ng-model="obj"
               style="width: 100%;"
               k-value="'12/15/2016 12:00 AM'"/>

 

I am able to reproduce this problem using the kendo angular demo for the date time picker.  How can I set an initial value for the date time picker?

 

Thanks

3 Answers, 1 is accepted

Sort by
0
Accepted
Dimiter Topalov
Telerik team
answered on 30 Dec 2016, 04:40 PM
Hi Allan,

If the widget is bound via k-ng-model, this overrides the k-value directive. You can either use k-value only, or provide an initial value in the scope for the k-ng-model binding:

http://dojo.telerik.com/ocAhu 

... or

http://dojo.telerik.com/ocAhu/2

I hope this helps.

Regards,
Dimiter Topalov
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Nitin
Top achievements
Rank 1
commented on 29 Apr 2021, 12:28 PM

Hi Dimiter, I want default value and also want the changed value in dom
Tsvetomir
Telerik team
commented on 03 May 2021, 06:37 AM

Hi Nitin, the default value could be set inside the controller. If you are using the k-ng-bind, you should supply a value to the property to which the k-ng-bind is specific, e.g http://dojo.telerik.com/akEsoKaG

Could you share more information on what default value would you like to set? In general, if the value is changed inside the picker, it is reflected in the DOM automatically.
0
Allan
Top achievements
Rank 1
answered on 30 Dec 2016, 04:45 PM
Thanks Dimiter.  I assume the same holds true if I use just the ng-model attribute and not k-ng-model?
0
Dimiter Topalov
Telerik team
answered on 02 Jan 2017, 09:40 AM
Hi Allan,

This is correct:

http://dojo.telerik.com/ocAhu/7

However, in this case please take into account the differences between the ng-model and k-ng-model binding, as described in the following section of our documentation:

http://docs.telerik.com/kendo-ui/AngularJS/introduction#scope-bindings

Regards,
Dimiter Topalov
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Date/Time Pickers
Asked by
Allan
Top achievements
Rank 1
Answers by
Dimiter Topalov
Telerik team
Allan
Top achievements
Rank 1
Share this question
or