title: AngularJS - Set a class name defined in the scope
body: <p>I am using AngularJS 1.05</p>
  
  <p>I'd like to have something like this:</p>
  
  <p>In my controller:</p>
  
  <pre><code>$scope.location = $location.path().split('/')[2]
  $scope.lang = $routeParams.lang
  $scope.bodyClassName = ((if $scope.location isnt "login" then "sub" else ""))
  </code></pre>
  
  <p>I'd like to report these variables in an document object to get for example:</p>
  
  <pre><code>&lt;div class="home en sub"&gt;&lt;/div&gt;
  </code></pre>
  
  <p>I tried with</p>
  
  <p><code>&lt;div class="{{location}} {{lang}} {{bodyClassName}}"&gt;&lt;/div&gt;</code></p>
  
  <p>It works on the first load but not when the view get refresh.</p>
  
  <p>As the documentation says, <strong>ng-class</strong> is made to <strong>evaluate</strong> expressions, but I need to <strong>print</strong> a variable.</p>
  
  <p>What is the good way for that?</p>