I have issue with angular date
inputs.
Example code:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<script>
angular.module('app', []).controller('ACtrlr', function($scope){
$scope.start = new Date();
$scope.plusDay = function(s){
console.log(s);
$scope.start.setDate($scope.start.getDate() + 1);
};
});
</script>
<div ng-app="app" ng-controller="ACtrlr">
<input type="date" ng-model="start" />
<input type="date" ng-model="start" />
{{start}}
<button ng-click="plusDay(start)" >+</button>
</div>
If I change this programmaticaly(click a button first), model changes correctly, but no values in inputs presented. If I change date input immediately, model becomes simple text like 2014-12-29
and all brakes.
Earlier I used this with text values only, but now I get this exception.
Knows anybody what's wrong here? And what is correct way to work with input[type=date]
s?
Google Chrome 38.0.2125.111 (64-bit)
Aucun commentaire:
Enregistrer un commentaire