Remove angular comments from html

Is it possible to remove or disable HTML angular comments?

<ol class="items"> <!-- ngRepeat: item in list | orderBy:'time':true --> </ol> 

Its tearing CSS rules that use the class :empty pseudo-class.

 ol:empty { content: "No results"; } 

In order for the rule to apply, there should be no spaces or comments:

 <ol></ol> 
+7
angularjs css
source share
4 answers

In the end, I added the .empty class with ng-class="{ empty: !list.length }" and applied the CSS rule this way without relying on the :empty pseudo-element.

+2
source share
 $compileProvider.debugInfoEnabled(false); 

But it can break some plugins that have links to angular comments.

+1
source share

Not the most efficient or direct way to do this, you can use javascript to remove the contents of the elements. Something like this should work:

 document.getElementsByClassName('items').innerHTML = ""; 

I don’t know what your structure is, but I’m sure you could do it before the CSS loads ...

Edit

By reading the post related to @zsong and this post here , you may end up breaking Angular while trying to do this. Only one way to find out, I think!

0
source share

The content property is used with the :before and :after pseudo-elements

you can try this

0
source share

All Articles