title: Using class with angular vs ng-class while using a mixed expression
body: <p>I have a div that I want to give a dynamic class with AngularJS.</p>
  
  <p>The div is withing an ng-repeat statement where lang.prefix is first en then sv</p>
  
  <p>Using the following code works and sets the class to i-flag-en than i-flag-sv, but is it correct?</p>
  
  <pre><code>&lt;div class="float-left flag i-flag-{{lang.prefix}}"&gt;&lt;/div&gt;
  </code></pre>
  
  <p>I know there exist a <a href="https://docs.angularjs.org/api/ng/directive/ngClass">ng-class</a> directive which can be used to dynamically set the class of an element with AngularJS.</p>
  
  <p>I think I read somewhere in a book, that the normal class directive not should be used to set the class property dynamically with AngularJS because of the way Angular manipulates the dom.</p>
  
  <p>However, the following code does not work:</p>
  
  <pre><code>&lt;div class="float-left flag" ng-class="i-flag-{{lang.prefix}}"&gt;&lt;/div&gt;
  </code></pre>
  
  <p>and I rather want to set the class in this way instead of creating another scope variable.</p>
  
  <p><strong>Is it bad practice to use the class attribute with AngularJS to dynamically set the class? Does it work all the time even if it would be bad practice?</strong></p>