brianpkelley / md-color-picker

Angular-Material based color picker
MIT License
254 stars 119 forks source link

Int values in md-model for color #82

Closed ghost closed 8 years ago

ghost commented 8 years ago

Hi,

I would like to use this wonderful colorpicker to set a .net color value (backend) which is stored as int type. I tried to convert the md-model by $formatter/$parser (hex->int and int->hex) but it does not work properly.

Any suggestions how to handle this problem?

Thank you in advance. Bjaybo

ghost commented 8 years ago

$formatter/$parser does not work properly because: Original code: // Keep an eye on changes $scope.$watch(function() { return ngModel.$modelValue; },function(newVal) { updateValue(newVal); }); Should be: // Keep an eye on changes $scope.$watch(function() { return ngModel.$viewValue; },function(newVal) { updateValue(newVal); });

That worked for me. :-)