title: How to remove angularjs attributes and classes from HTML?
body: <p>I have a simple AngularJS app that renders a parent element containing some nested elements from a template using ng-bind and ng-repeat. I would like to grab the HTML (innerHtml) of the generated element (as a string) for usage in a different application (where it is to be used as static HTML, outside the context of AngularJS). </p>
  
  <p>This is easy enough to do by using <code>jQuery('#parent-element').html()</code>. The problem with this approach is that the HTML string contains Angular attributes (for example ng-bind) as well as Angular generated comments (from ng-repeat) and classes (such as ng-scope).</p>
  
  <p>I can probably come up with some regular expression to clean up all of these from the string directly, but I would love to know if there is a cleaner way to do this.</p>
  
  <p>So, is there a more "Angular" way to either prevent the attributes/classes/comments from being generated or to extract a clean version of the source HTML of the generated elements?</p>
  
  <p><strong>UPDATE:</strong>
  For @suhas-united and others who might find this useful, I ended up using the following which works well enough for my use case-</p>
  
  <pre><code>var cleaner = angular.element('#dirtier')
              .html()
              .replace(/&lt;!--[^&gt;]*--&gt;/gi, '')
              .replace(/\n/g, '')
              .replace(/ng-.+?\b/g, '')
              .replace(/ng-.+?=".*?"/g, '')
              .replace(/class=""/g, '')
              .replace(/\"/g, "\\\"")
              .replace(/\s+/g, " ");
  </code></pre>