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
Post a Comment