2

so I am trying to bind value for input of type date..

Here is my AngularJS code that I am trying to bind the value to:

$scope.date = new Date();
$scope.dateString = dateFilter($scope.date,'dd-MM-yyyy');

And html:

<input class="date" type="date" ng-bind="dateString">

What I am trying to do, is I am trying to set default value to todays date. However, when I am loading my page, it just gives me following result:

<input class="date ng-binding" type="date" ng-bind="dateString">08-04-2015</input>

Any help will be more than welcome :)

Thanks, uksz

uksz
  • 18,239
  • 30
  • 94
  • 161

1 Answers1

0

You need to be using version 1.3 or higher for date support. you also want to use ng-model instead of ng-bind, because ng-bind is one way only

trees_are_great
  • 3,881
  • 3
  • 31
  • 62
  • Thanks so much! Turns out I am using 1.2.26. – uksz Apr 08 '15 at 16:18
  • Is updating version pretty straight forward? Or I need to take a look at keynotes, to change my code :)? – uksz Apr 08 '15 at 16:18
  • Ok, so most likely I wont be able to update to 1.3 as ionic framework doesnt support it yet. Is there any way i can go around this problem? – uksz Apr 08 '15 at 16:25
  • are you using bootstrap, there are a selection a date picker directives that you can use. If you are using bootstrap, then this: https://github.com/dalelotts/angular-bootstrap-datetimepicker – trees_are_great Apr 08 '15 at 16:35
  • Actually, dependencies you will need are: AngularJS 1.2.26 or higher (1.0.x will not work) moment.js 2.8.3 or higher for date parsing and formatting bootstrap's glyphicons for arrows (Can be overridden in css) – trees_are_great Apr 08 '15 at 16:37