title: AngularJS: Error with remove- and addClass: c.attr is not a function
body: <p><strong>Background</strong></p>
  
  <p>I need to do custom form validation based on complex business rules. I will show this validation to the user by changing classes dynamically, (likely) using multiple classes that are meaningful to the user.</p>
  
  <p>See my <a href="https://stackoverflow.com/questions/32439287/angularjs-conditional-ng-class-with-a-function-triggering-ridiculous-amounts/32439543?noredirect=1#comment52743658_32439543">previous question</a>.</p>
  
  <p>As it seems that ng-class is unreliable (runs too often), I'm looking into alternatives. And, it's actually not a bad thing to do the whole validation at a top level, then I can make sure I do just one backend call only (whenever necessary).</p>
  
  <p>Another requirement is, I don't want/can't use jQuery, because the form may occur several times, since jQuery is not scope aware, this will not (easily) work (and, the cleaner the better).</p>
  
  <p><strong>Plunkr tryout</strong></p>
  
  <p>Consider this <a href="http://plnkr.co/edit/gL65cOTkjVBimkgPsiq4?p=preview" rel="nofollow noreferrer">Plunkr</a> example.</p>
  
  <p><strong>The question</strong></p>
  
  <p>The above plunkr uses $animate.removeClass and $animate.addClass to dynamically change classes, but it results in this error:</p>
  
  <pre><code>TypeError: c.attr is not a function
      at angular.js:4907
      at m (angular.js:336)
      at angular.js:4904
      at n.a.$get.n.$digest (angular.js:15803)
      at n.a.$get.n.$apply (angular.js:16024)
      at angular.js:1658
      at Object.e [as invoke] (angular.js:4473)
      at d (angular.js:1656)
      at yc (angular.js:1676)
      at Zd (angular.js:1570)
  </code></pre>
  
  <p><em>I get a similar error in the actual code, but there it's on the element (no minification?)</em>:</p>
  
  <pre><code>TypeError: element.attr is not a function
      at angular.js:4886
      at forEach (angular.js:336)
      at angular.js:4883
      at Scope.$digest (angular.js:15735)
      at Scope.$apply (angular.js:15953)
      at done (angular.js:10366)
      at completeRequest (angular.js:10538)
      at XMLHttpRequest.requestLoaded (angular.js:10479)
  </code></pre>
  
  <p>Any suggestions?</p>