-
+
diff --git a/UI/WebServerResources/js/Common/sgColorPicker.directive.js b/UI/WebServerResources/js/Common/sgColorPicker.directive.js
index acac31c2b..4bbe79640 100644
--- a/UI/WebServerResources/js/Common/sgColorPicker.directive.js
+++ b/UI/WebServerResources/js/Common/sgColorPicker.directive.js
@@ -14,50 +14,53 @@
*/
- sgColorPicker.$inject = ['$parse'];
- function sgColorPicker($parse) {
+ function sgColorPicker() {
return {
restrict: 'E',
+ require: 'ngModel',
template: [
'',
- ' ',
- ' color_lens',
+ ' color_lens',
' ',
- ' ',
+ ' ',
' ',
- ' ',
+ ' ng-click="setColor(color)">',
' ',
' ',
''
].join(''),
replace: true,
- bindToController: true,
controller: sgColorPickerController,
- controllerAs: '$sgColorPickerController',
link: link
};
- function link(scope, iElement, iAttr, controller) {
- // Associate callback to controller
- controller.doSelect = $parse(iElement.attr('sg-on-select'));
+ function link(scope, iElement, iAttr, ngModelController) {
+ // Expose ng-model value to scope
+ ngModelController.$render = function() {
+ scope.sgColor = ngModelController.$viewValue;
+ };
}
}
/**
* @ngInject
*/
- sgColorPickerController.$inject = ['$scope', 'sgColors'];
- function sgColorPickerController($scope, sgColors) {
- var vm = this;
+ sgColorPickerController.$inject = ['$scope', '$element', 'sgColors'];
+ function sgColorPickerController($scope, $element, sgColors) {
+ var ngModelController = $element.controller('ngModel');
- vm.colors = sgColors.selection;
- vm.select = function(color) {
- vm.doSelect($scope, { color: color });
+ $scope.sgColors = sgColors.selection;
+ $scope.setColor = function(color) {
+ // Update scope value and ng-model
+ $scope.sgColor = color;
+ ngModelController.$setViewValue(color);
};
}
diff --git a/UI/WebServerResources/js/Scheduler/CalendarsController.js b/UI/WebServerResources/js/Scheduler/CalendarsController.js
index 035632ee2..6f83b282c 100644
--- a/UI/WebServerResources/js/Scheduler/CalendarsController.js
+++ b/UI/WebServerResources/js/Scheduler/CalendarsController.js
@@ -144,19 +144,17 @@
/**
* @ngInject
*/
- PropertiesDialogController.$inject = ['$timeout', '$mdDialog', 'srcCalendar'];
- function PropertiesDialogController($timeout, $mdDialog, srcCalendar) {
+ PropertiesDialogController.$inject = ['$scope', '$mdDialog', 'srcCalendar'];
+ function PropertiesDialogController($scope, $mdDialog, srcCalendar) {
var vm = this;
vm.calendar = new Calendar(srcCalendar.$omit());
- vm.setColor = setColor;
vm.saveProperties = saveProperties;
vm.close = close;
- function setColor(color) {
- vm.calendar.color = color;
- srcCalendar.color = color;
- }
+ $scope.$watch('properties.calendar.color', function() {
+ srcCalendar.color = vm.calendar.color;
+ });
function saveProperties() {
vm.calendar.$save();