Closed kinging123 closed 8 years ago
Your Plunkr shows me good results, the placeholders are as intended...
Forgive me if I haven't described the issue correctly.
The placeholders are working just fine, but try to click on the colorpicker:
The second one works fine:
The first one though shows only red colorpicker and no bootstrap addon:
In your scenario on this line (https://github.com/ruhley/angular-color-picker/blob/master/src/scripts/controller.js#L402) it tries to merge the passed in options object with the default options object. Logging out the options object after the merge function results in the expected output. However outputting the options object in the html {{AngularColorPickerController.options}}
only shows the provided options object, not the merged one. This only happens when using and inline options object -
<color-picker ng-model="color" options="{placeholder: myColor}" ></color-picker>
This does not happen if the options object is a defined variable and still using a variable in the placeholder.
$scope.options = {
placeholder: myColor
};
<color-picker ng-model="color" options="options" ></color-picker>
It also works as expected if after the merge I assign the options object to another variable this.optionsClone = this.options;
and then use that. I feel like this is some sort of weird AngularJS bug that two way binding doesn't work on inline objects with a variable.
If you absolutely have to pass in the options object inline then I put in the optionsClone
hack for you. However I would rather fix the root cause of the problem.
I am closing this issue as there has not been an update in a while and I believe it is an AngularJS bug. Please reopen this issue if you feel it has not been resolved.
Here's a Plunkr demo: https://plnkr.co/edit/Ho9NBEogYkqrU0w6UpnV?p=preview
The placeholder shows just fine but everything else is messed up.
This code works:
This doesn't:
(When $scope.myColor is defined)