i've a strange behaviour with a model.
$scope.ev = temp;
<input type="text" class="form-control" id="inputDataFineEv" ng-model="ev.dataOraFineEvento" placeholder="Data fine" value="{{ev.dataOraFineEvento | date:'dd/MM/yyyy'}}">
The result in html source is:
<input type="text" class="form-control ng-pristine ng-untouched ng-valid" id="inputDataFineEv" ng-model="ev.dataOraFineEvento" placeholder="Data fine" value="12/09/2015">
and on screen i see timestamp
What am I doing wrong?
Thanks
First of all you can't use the value
attribute with an ng-model
because it's ng-model
to do the bind, so you should filter the date from the controller to directly bind it filtered:
HTML:
<input type="text" class="form-control" id="inputDataFineEv" ng-model="ev.dataOraFineEvento" placeholder="Data fine">
JS:
angular.module('myApp', ['ngSanitize'])
.controller('dummy', ['$scope', '$filter', function ($scope, $filter) {
$scope.ev = {
dataOraFineEvento: $filter('date')((1441113680*1000), 'mm/dd/yyyy')
};
}]);