[Time Conductor] Submit immediately on picker changes

This commit is contained in:
Victor Woeltjen 2015-11-25 11:16:31 -08:00
parent 1ef09ffbdd
commit 16efd85dfc
2 changed files with 12 additions and 2 deletions

View File

@ -12,8 +12,8 @@
<mct-popup ng-if="picker.active">
<div mct-click-elsewhere="picker.active = false">
<mct-control key="'datetime-picker'"
ng-model="ngModel"
field="field"
ng-model="pickerModel"
field="'value'"
options="{ hours: true }">
</mct-control>
</div>

View File

@ -55,6 +55,7 @@ define(
$scope.textInvalid = false;
$scope.lastValidValue = $scope.textValue;
}
$scope.pickerModel = { value: value };
}
function updateFromView(textValue) {
@ -66,6 +67,14 @@ define(
}
}
function updateFromPicker(value) {
$scope.ngModel[$scope.field] = value;
updateFromModel(value);
if ($scope.structure && $scope.structure.submit) {
$scope.structure.submit();
}
}
function setFormat(format) {
formatter = formatService.getFormat(format || defaultFormat);
updateFromModel($scope.ngModel[$scope.field]);
@ -82,6 +91,7 @@ define(
$scope.$watch('structure.format', setFormat);
$scope.$watch('ngModel[field]', updateFromModel);
$scope.$watch('pickerModel.value', updateFromPicker);
$scope.$watch('textValue', updateFromView);
}