我正在使用 AngularJS 从 ASP.NET 服务器应用程序获取数据并将其显示在客户端。这是我得到的:
ProjectID │ CreatedOn
══════════╪══════════════════════
13241 │ /Date(1338364250000)/
13411 │ /Date(1338370907000)/
如您所见,日期显示不正确。我想将日期格式化为YYYY-MM-DD HH:MM:SS
. 我怎样才能做到这一点?
HTML 视图:
<div ng-app ng-controller="FirstCtrl">
<table>
<thead>
<tr>
<td>
ProjectID
</td>
<td>
CreatedOn
</td>
</tr>
</thead>
<tbody>
<tr ng-repeat="team in teams" class="thumbnail">
<td>
{{team.ProjectID}}
</td>
<td>
{{team.CreatedOn}}
</td>
</tr>
</tbody>
</table>
</div>
动作方法:
public JsonResult GetUser()
{
return Json(new { data = ProjectService.GetPrefixUsedCount(1).ToArray() });
}
返回的 JSON 结果:
{"data":[{"ProjectID":13241,"CreatedOn":"\/Date(1338364250000)\/"},
{"ProjectID":13411,"CreatedOn":"\/Date(1338370907000)\/"}]