mirror of
https://github.com/nasa/openmct.git
synced 2025-06-14 13:18:15 +00:00
[Forms] Date time controls
Implement date time controls up to the point that they validate, and information (albeit not the right information) propagates back up to the containing form. WTD-530.
This commit is contained in:
34
platform/forms/src/controllers/DateTimeController.js
Normal file
34
platform/forms/src/controllers/DateTimeController.js
Normal file
@ -0,0 +1,34 @@
|
||||
/*global define*/
|
||||
|
||||
define(
|
||||
[],
|
||||
function () {
|
||||
|
||||
function DateTimeController($scope) {
|
||||
|
||||
function update() {
|
||||
var date = $scope.datetime.date,
|
||||
hour = $scope.datetime.hour,
|
||||
min = $scope.datetime.min,
|
||||
sec = $scope.datetime.sec;
|
||||
|
||||
$scope.ngModel[$scope.field] = [
|
||||
date,
|
||||
hour,
|
||||
min,
|
||||
sec
|
||||
].join(".");
|
||||
}
|
||||
|
||||
$scope.$watch("datetime.date", update);
|
||||
$scope.$watch("datetime.hour", update);
|
||||
$scope.$watch("datetime.min", update);
|
||||
$scope.$watch("datetime.sec", update);
|
||||
|
||||
$scope.datetime = {};
|
||||
}
|
||||
|
||||
return DateTimeController;
|
||||
|
||||
}
|
||||
);
|
Reference in New Issue
Block a user