Angaddict
Angaddict

Reputation: 1

Assigning Date from SQL Server to Angular Js

This always seems to be a nightmare for me. am new to angular js. Please suggest me the best solution. I have datefield from MS SQL Server, which to be displayed in HTML Page in input date type field. But am not getting the date assigned. In SQL Server it is a DATETIME field

Html Code

<input type="date" id="end_date" ng-model="end_date" value="{{end_date}}" />

JS Code

$scope.end_date = response.data[0].end_date;

I even tried with

response.data[0].end_date.date;

Upvotes: 0

Views: 623

Answers (1)

MrWook
MrWook

Reputation: 348

You can debug your code with console.log() to see if the data is set correct. Also the the value for the type "date" need to have this format "YYYY-MM-DD". It won't work with a datetime string.

Upvotes: 0

Related Questions