Issue
I need to show today's date in my date input:
<input type="date" ng-model="data.date">
Here is my JS Code:
$scope.data = {};
$scope.data.date = new Date().toDateString();
But the result is only:
What did I wrong?
Solution
You can use input[type='date']
, but format data must be a valid ISO date string (yyyy-MM-dd)
<input type="date" ng-model="data.date">
and code
$scope.data = {};
$scope.data.date = new Date();
or convert today's date into a readable string
<input type="text" ng-model="data.date">
then code
$scope.data = {};
$scope.data.date = new Date().toDateString();
Answered By - Alexey Semenyuk
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.