0

I'm getting json data from api, I have a field called PURCHASEDATE with type: Date in mysql.

I made an http request and got all the data.

html:

<input type="date" ng-model="purchaseDate">

js:

//get function
$scope.purchaseDate=row.PURCHASEDATE;

I tried to alert and console log, everything is ok, I got the date : 2017-01-16

I tried to print the input value in html @{{purchaseDate}} and it's printing 2017-01-16.

the problem is that the date is not filling in the html input date. Any idea?

8
  • did you try to put it in the value? Commented Feb 27, 2017 at 8:30
  • $scope.purchaseDate=row.PURCHASEDATE; the ngmodel is filling with the value, but the input not showing the date Commented Feb 27, 2017 at 8:33
  • 1
    <input type="date" ng-model="purchaseDate" value="@{{purchaseDate}}"> Commented Feb 27, 2017 at 8:36
  • yes I tried that, not working Commented Feb 27, 2017 at 8:38
  • 1
    stackoverflow.com/questions/10610282/… stackoverflow.com/questions/12421979/… Commented Feb 27, 2017 at 8:46

1 Answer 1

0

working fine, the solution is, when I get the data, I used :

$scope.purchaseDate= new Date(row.PURCHASEDATE);

thank you

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.