colmol29 colmol29 - 3 months ago 11
AngularJS Question

Styling an angular directive on ng-click with isolate scope

I have two directives that should both use isolate scopes,

. When I click on the
directive, I want to change the background color of the other directive. Before importing my code into JSFiddle, I also had it working so that by default, a placeholder image appears in the flag directive, but once you click on that image, the country flag appears instead.

Can someone help with the styling a separate directive on ng-click?

Here's my code:
(My countries data isn't working in JSFiddle for some reason)


You can do it with requiring one directive from another. In this example you can require outer-box to be a parent of flag. With this you have the access to required directive controller ( 4th parameter in link function), so you can call a method to set class on element.

Working JSFiddle :