我有一个表格<input type="date">。
当我在此输入中绑定数据时,它将显示日期-1天。
HTML:
<div class="input-field col s12">
<label>Fecha Nacimiento </label>
<input type="date" class="form-control" id="fnac" name="fnac" ng-model="unapersona.fnac">
</div>
Run Code Online (Sandbox Code Playgroud)
控制器:
$scope.cargarpersona = function(id) {
$http.get("modelos/personas_json.php?id="+id)
.success(function(data) {
$scope.unapersona = eval(data);
//... Other data
$scope.unapersona.fnac = new Date($scope.unapersona[0]["fnac"]);
//... Other data
})
.error(function(data) {
console.log('Error: ' + data);
});
}
Run Code Online (Sandbox Code Playgroud)