diff --git a/platform/commonUI/general/bundle.json b/platform/commonUI/general/bundle.json index ca98296be4..8d0d7e39a4 100644 --- a/platform/commonUI/general/bundle.json +++ b/platform/commonUI/general/bundle.json @@ -55,6 +55,11 @@ "key": "BottomBarController", "implementation": "BottomBarController.js", "depends": [ "indicators[]" ] + }, + { + "key": "GetterSetterController", + "implementation": "GetterSetterController.js", + "depends": [ "$scope" ] } ], "directives": [ diff --git a/platform/commonUI/general/res/templates/controls/input-filter.html b/platform/commonUI/general/res/templates/controls/input-filter.html index 303a8db257..3c6be1684e 100644 --- a/platform/commonUI/general/res/templates/controls/input-filter.html +++ b/platform/commonUI/general/res/templates/controls/input-filter.html @@ -1,5 +1,13 @@ - - - x + + + + x + \ No newline at end of file diff --git a/platform/commonUI/general/src/GetterSetterController.js b/platform/commonUI/general/src/GetterSetterController.js new file mode 100644 index 0000000000..0e58220ee2 --- /dev/null +++ b/platform/commonUI/general/src/GetterSetterController.js @@ -0,0 +1,30 @@ +/*global define*/ + +define( + [], + function () { + "use strict"; + + function GetterSetterController($scope) { + + function updateGetterSetter() { + if (typeof $scope.ngModel === 'function') { + $scope.getterSetter.value = $scope.ngModel(); + } + } + + function updateNgModel() { + if (typeof $scope.ngModel === 'function') { + $scope.ngModel($scope.getterSetter.value); + } + } + + $scope.$watch("ngModel()", updateGetterSetter); + $scope.$watch("getterSetter.value", updateNgModel); + $scope.getterSetter = {}; + } + + return GetterSetterController; + + } +); \ No newline at end of file