Question

I am not sure if I am doing this right. I am trying to set the background of a div by choosing a color with a color picker. I have this jsfiddle to show what i am trying to do. However the TargetColor doesn't seem to be binding. Am I going about this the wrong way? Anyone have any suggestions on how to do this with an example? The ending idea would be to change the colors of all the containers on the page on color change (the number of containers could be pretty high and new one can be made which is why the style tag is being used).

Was it helpful?

Solution

Here's a fiddle with a directive to handle that: http://jsfiddle.net/g/LAJCa/

As mentionned in the comments, you should'nt do DOM manipulations outside directives, you'll not benefit a lot from angular if you don't respect the guidelines: http://docs.angularjs.org/guide/dev_guide.mvc.understanding_controller

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top