Skip to content

Commit

Permalink
Merge pull request #3 from billyaraujo/master
Browse files Browse the repository at this point in the history
Update angular-pick-a-color.js
  • Loading branch information
cdjackson committed Jun 2, 2015
2 parents 5620351 + 1b6cbbc commit 284af9c
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions src/angular-pick-a-color.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,34 +41,40 @@ angular.module('pickAColor', [])
return function (scope, element, attrs, controller) {
// Process options
var options = pickAColor.getOptions();
if (attrs.inlineDropdown != null) {
if (attrs.inlineDropdown !== null) {
options.inlineDropdown = attrs.inlineDropdown;
}
if (attrs.showSpectrum != null) {
if (attrs.showSpectrum !== null) {
options.showSpectrum = attrs.showSpectrum;
}
if (attrs.showSavedColors != null) {
if (attrs.showSavedColors !== null) {
options.showSavedColors = attrs.showSavedColors;
}
if (attrs.saveColorsPerElement != null) {
if (attrs.saveColorsPerElement !== null) {
options.saveColorsPerElement = attrs.saveColorsPerElement;
}
if (attrs.fadeMenuToggle != null) {
if (attrs.fadeMenuToggle !== null) {
options.fadeMenuToggle = attrs.fadeMenuToggle;
}
if (attrs.showAdvanced != null) {
if (attrs.showAdvanced !== null) {
options.showAdvanced = attrs.showAdvanced;
}
if (attrs.showBasicColors != null) {
if (attrs.showBasicColors !== null) {
options.showBasicColors = attrs.showBasicColors;
}
if (attrs.showHexInput != null) {
if (attrs.showHexInput !== null) {
options.showHexInput = attrs.showHexInput;
}
if (attrs.allowBlank != null) {
if (attrs.allowBlank !== null) {
options.allowBlank = attrs.allowBlank;
}

scope.$watch(model, function(value) {
element.val(model(scope));
element.focus();
element.blur();
});

// Set the value before we initialise the picker
element.val(model(scope));

Expand Down

0 comments on commit 284af9c

Please sign in to comment.