title: How do I compare dates in angular ng-class
body: <p>I have the following code</p>
  
  <pre><code>&lt;div ng-class"{'has-error': myInputForm.$valid}"&gt;
    ...other stuff....
  &lt;/div&gt;
  </code></pre>
  
  <p>I love this kind of validation and the above code works. What I would like to do is compare two date values so it would look like this....</p>
  
  <pre><code>&lt;div ng-class"{'has-error': myStartDate &lt; eventStartDate}"&gt;
    ...other stuff....
  &lt;/div&gt;
  </code></pre>
  
  <p>This doesn't work and neither does this, but it would be nice if it did</p>
  
  <pre><code>&lt;div ng-class"{'has-error': moment(myStartDate).isBefore(eventStartDate)}"&gt;
    ...other stuff....
  &lt;/div&gt;
  </code></pre>
  
  <p>I could make a function to return the class based on parameters </p>
  
  <pre><code>&lt;div ng-class"getClass(myStartDate,eventStartDate)"&gt;
    ...other stuff....
  &lt;/div&gt;
  </code></pre>
  
  <p>but I have other things that need to be checked, so I would like to do this inline. Let me know what ideas you have and thanks in advance.</p>