【发布时间】:2017-07-28 11:27:20
【问题描述】:
我在控制器中有一个动作方法,它返回 json 结果为:
public ActionResult GetByDids(int id)
{
AngularMVCEntities _db = new AngularMVCEntities();
var emps = _db.Employees.Where(x => x.Did == id).ToList();
return Json(emps, JsonRequestBehavior.AllowGet);
}
还有一个 Angular js 中的代码,例如:
app.controller('employeesController', function ($scope, $http) {
$scope.GetEmployeesByDid = function (did) {
alert('Get Employees By Id' + ' ' + did);
$http.get('/Employees/GetByDids', { params: { id: did } }).then(function (response) {
$scope.Emps = response.data;
});
};
});
如何将 json DATE 转换为字符串?
【问题讨论】:
-
您需要从该字符串值中提取相关的日期信息,并根据需要使用它来构建一个 Date 对象。看到这个stackoverflow.com/questions/42074532/…
标签: angularjs json asp.net-mvc