title: Adding multiple expressions using ng-class in AngularJS
body: <p>I am trying to set the class <code>.active</code> when the path is <code>http://localhost/#/</code> or <code>http://localhost/#/main/</code> as both paths are the same page.</p>
  
  <p>Why does <code>ng-class="{'class1' : expression1, 'class1' : expression2}"</code> not work?</p>
  
  <p><strong>Controller</strong></p>
  
  <pre><code>angular.module('testApp')
    .controller('NavmenuCtrl', function ($scope, $location) {
    $scope.isActive = function (providedPath) {
      return providedPath === $location.path();
    };
  });
  </code></pre>
  
  <p><strong>Partials View</strong></p>
  
  <pre><code>&lt;li ng-class="{ active: isActive('/'), active: isActive('/main/')}"&gt;
    &lt;a href="#/"&gt;Home&lt;/a&gt;
  &lt;/li&gt;
  </code></pre>
  
  <p>Related links</p>
  
  <p><a href="https://stackoverflow.com/questions/18871277/adding-multiple-class-using-ng-class">Adding multiple class using ng-class</a></p>
  
  <p><a href="https://stackoverflow.com/questions/22887513/angularjs-ng-class-multiple-conditions">AngularJS ng-class multiple conditions</a></p>
  
  <p><a href="https://coderwall.com/p/r3_geg" rel="nofollow noreferrer">Oliver Tupman: Keep CSS classes out of your Angular controllers</a></p>
  
  <p><a href="http://scotch.io/tutorials/javascript/the-many-ways-to-use-ngclass" rel="nofollow noreferrer">Scotch.io: the many ways to use ng-class</a></p>