Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

remove angular comments from html

Tags:

css

angularjs

Is it possible to remove or disable the HTML comments angular produces?

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

Its breaking CSS rules that use :empty pseudo class.

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

In order for the rule to be applied, there needs to be no whitespace or comments:

<ol></ol>
like image 743
chovy Avatar asked Dec 19 '13 21:12

chovy


2 Answers

I ended up adding a class .empty with ng-class="{ empty: !list.length }" and applying the CSS rule that way without relying on the pseudoelement :empty.

like image 178
chovy Avatar answered Oct 01 '22 10:10

chovy


$compileProvider.debugInfoEnabled(false);

But it can broke some plugins which have references on angular comments.

like image 43
Andrei Avatar answered Oct 01 '22 09:10

Andrei