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

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -