Error: [ngModel:datefmt] Expected `2015-05-29T19:06:16.693209Z` to be a date - Angular

前端 未结 8 702
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-11-29 07:10

I\'m working on angularapplication with Django with rest-framework..

The app receives it\'s info with json from the server.. O

8条回答
  •  心在旅途
    2020-11-29 07:37

    If you get your data from a REST Service, you can simply convert your fields to Date.

    $http.get(url).success(function(data){
         $scope.data = data; // get row data
         $scope.data.mydatefield = new Date($scope.data.mydatefield); // convert filed to date
    });
    

提交回复
热议问题