html - change input text value with angular -
i have basic input displaying timestamp in milliseconds, saved on scope.
however, want display formatted time, , dont want store new variable.
i looking solution this:
ng-model="parsetime(timestamp)"
and in controller:
$scope.parsetime = function(systemtime) { var time = new date(systemtime); return time.todatestring(); };
is not possible, can using watch
$scope.$watch('timestamp', function(value) { if (value) { var time = new date(value); $scope.timestamp= time.todatestring(); } });
html should
ng-model="timestamp"
Comments
Post a Comment