後端日期型態資料透過 json 丟給前端的 input type=date 綁定 ng-model 無法顯示預設值
前端取得資料後要再轉換成 Date 物件,範例 :
$http.post('CheckReport/查詢').success(function (data, status, headers, config) {
angular.forEach(data, function (obj, key) {
if (obj.shareDate != null) obj.shareDate = new Date(obj.shareDate);
});
$scope.gridOptions.data = data;
}).catch(function (data, status, headers, config) {
if (status != undefined) alert(data.statusText);
console.log(data.data);
});
$http.post('CheckReport/查詢').success(function (data, status, headers, config) {
angular.forEach(data, function (obj, key) {
if (obj.shareDate != null) obj.shareDate = new Date(obj.shareDate);
});
$scope.gridOptions.data = data;
}).catch(function (data, status, headers, config) {
if (status != undefined) alert(data.statusText);
console.log(data.data);
});
留言