title: How to apply the ng-class based attributes and click in Angular?
body: <p>We need to change the CSS class based on the data-toggle attributes and on user click. We already can change the class based on user click events.</p>
  
  <p>How can I change the class on both user click and based on the data-toggle attributes?</p>
  
  <p>HTML:</p>
  
  <pre><code>&lt;a ng-click="iconChange('FF'+$index)" 
     href="#" data-toggle="collapse"&gt;
     &lt;span  title="{{idx}}" 
            ng-class="{'glyphicon1 down': FF{{$index}}, 'glyphicon1 right': !FF{{$index}} }" &amp;&amp; 
            ng-attr-data-toggle="{{ collapse ? true : false }}"&gt;
       &lt;/span&gt;
   &lt;/a&gt;
  </code></pre>
  
  <p>JS:</p>
  
  <pre><code>$scope.iconChange = function(idx){
                              $scope[idx] = !$scope[idx];
                          };
  </code></pre>