I have a json with current settings. Its structure is something like this:
{
color: '#111111',
opacity: '0.1',
text_area: {
color: "#222222"
opacity: "0.2"
},
something_else: {
color: "#333333",
opacity: "0.3"
}
}
Then I have some inputs on my page where user can select color values. Selection is performed by a MiniColors. When you define that user should select not only a color but an opacity as well, minicolors stores selected opacity value as attribute in input tag called "data-opacity". The color value (hex one) is stored similar way as any text in input.
To test things out, I have added to my html this:
{{settings.text_area.color}}
{{settings.text_area.opacity}}
My input tag looks like this:
<input id="ta" ng-model="settings.text_area.color" data-opacity="0.8"></input>
Of course, I can see only that the color value is displayed when I change a color, but how do I bind data-opacity attribute value (that will be changes each time user will select a new opacity value) to settings.text_area.opacity variable? It seems that I do have to make my own directive for that, no?