mirror of
https://github.com/nasa/openmct.git
synced 2025-04-17 15:59:09 +00:00
[Time Conductor] Update text on format change
...in a date-time field.
This commit is contained in:
parent
f42498ab60
commit
b12bb55495
@ -44,13 +44,6 @@ define(
|
||||
function DateTimeFieldController($scope, formatService, defaultFormat) {
|
||||
var formatter = formatService.getFormat(defaultFormat);
|
||||
|
||||
function setFormat(format) {
|
||||
formatter = formatService.getFormat(format || defaultFormat);
|
||||
if (!formatter) {
|
||||
throw new Error(UNRECOGNIZED_FORMAT_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
function updateFromModel(value) {
|
||||
// Only reformat if the value is different from user
|
||||
// input (to avoid reformatting valid input while typing.)
|
||||
@ -69,6 +62,14 @@ define(
|
||||
}
|
||||
}
|
||||
|
||||
function setFormat(format) {
|
||||
formatter = formatService.getFormat(format || defaultFormat);
|
||||
if (!formatter) {
|
||||
throw new Error(UNRECOGNIZED_FORMAT_ERROR);
|
||||
}
|
||||
updateFromModel($scope.ngModel[$scope.field]);
|
||||
}
|
||||
|
||||
$scope.$watch('structure.format', setFormat);
|
||||
$scope.$watch('ngModel[field]', updateFromModel);
|
||||
$scope.$watch('textValue', updateFromView);
|
||||
|
Loading…
x
Reference in New Issue
Block a user