I wrote a piece of code for getting a list of record from db and put them in $scope.records.
var app = angular.module('MyApp', []);
app.controller('MyAppController', ['$scope', '$http', function ($scope, $http) {
$http({ method: 'GET', url: '/Api/GetRecord' }).
success(function (data, status, headers, config) {
$scope.records = data;
}).
error(function (data, status, headers, config) {
alert(data);
});
}]);
Then, I want to display the records like below.
<div ng-repeat="record in records">
<div>{{record.ID}}</div>
<div>{{record.SubmitDate}}</div>
<div>{{record.Status}}</div>
</div>
The ID and status are shown correctly. However, the submit dates cannot show probably.The submit date is "2016-08-30 09:59:17.080" in db but all the submit dates become "/Date(1472522357080)/" while displaying in the website.
How can I display the datetime correctly? Thanks.
Try the new Date function as $scope.date = new Date (1472522357080); and bind the same $scope.date variable as ng-model to the date control.
try with date filter
or