0

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

screenshot

What am I doing wrong?

Thanks

1
  • What is temp? Or what is dataOraFineEvento? Commented Sep 1, 2015 at 13:21

1 Answer 1

0

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')
    };

}]);

JSFiddle

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.