我使用以下功能转换日期格式
$http.get('/api/url').then(function(response){
$scope.reports = response.data;
$scope.reports = $scope.reports.map(obj =>{
obj.created_at = new Date(obj.created_at);
return obj;
});
},function(error){
console.log("error");
});
除了 IE 之外,所有浏览器都运行良好我不知道这个功能有什么问题
答案 0 :(得分:3)
您在IE上不支持的Arrow
转换函数中使用了Lambda
/ map
函数。使用function
代替() => { ... }
或使用babel或打字稿。
$scope.reports = $scope.reports.map(function(){
obj.created_at = new Date(obj.created_at);
return obj;
});
检查Arrow function浏览器支持