html5 - Setting the default date for html 5 date type with angularjs -


i have set today,s date default in html date type , able check working fiddle click here , not working when changing ng-model my.date

    <input type="date" ng-model="my.date" value={{my.date}}>     //angular controller      function myctrl($scope, $filter) {      $scope.my.date = $filter("date")(date.now(), 'yyyy-mm-dd'); }      

why ??

$scope.my undefined , trying assign property date - that's why doesn't work. instead, define so:

$scope.my = {}; $scope.my.date = $filter("date")(date.now(), 'yyyy-mm-dd'); 

or, equivalently.

$scope.my = {date: $filter("date")(date.now(), 'yyyy-mm-dd')}; 

Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -