我在代码中使用angular-spectrum-colorpicker来使用spectrum.js。它基本上可以正常工作,除了值不是用model初始化的。以下是我使用的设置:
<spectrum-colorpicker ng-model="backgroundColor"
options="{
flat: true,
preferredFormat: 'hex',
showInput: true,
showButtons: false,
clickoutFiresChange: true,
}">
</spectrum-colorpicker>这里有一个jsbin来演示这个问题。你可以看到它工作得很好,除了在开始的时候颜色没有正确初始化。您可以通过切换输出面板来重现错误。
我错过了什么,或者是我应该在github上报告的错误?
发布于 2017-01-25 14:46:15
按选项传递color如何?
<spectrum-colorpicker ng-model="backgroundColor"
options="{
color: backgroundColor,
flat: true,
preferredFormat: 'hex',
showInput: true,
showButtons: false,
clickoutFiresChange: true,
}">https://stackoverflow.com/questions/41844602
复制相似问题