Toggle Class Using Angular Directive
<p>I want to toggle a class using the code below (thanks to <a href="https://stackoverflow.com/users/2867315/zombi">Zombi</a> for the <a href="https://stackoverflow.com/a/27418956/4180534">directive</a> he made) </p>

<p>I cannot figure out how to change a class of an element "B" by clicking element "A". Could you please suggest anything?</p>

<p>Angular</p>

<pre><code>module.directive('toggleClass', function() {
return {
    restrict: 'A',
    link: function(scope, element, attrs) {
        element.bind('click', function() {
            element.toggleClass(attrs.toggleClass);
        });
    }
};
</code></pre>

<p>HTML</p>

<pre><code>&lt;li&gt; &lt;- Clicked Element
    &lt;span toggle-class="open"&gt;&lt;/span&gt; &lt;-Toggled Class
&lt;/li&gt;
</code></pre>