remove angular comments from html

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>

我最终添加了一个类.empty ng-class="{ empty: !list.length }"并且不依赖于伪元素而应用CSS规则:empty


$compileProvider.debugInfoEnabled(false);

但它可以打破一些插件,其中有角色评论的参考。


While not the most efficient or direct way to do it, you could use javascript to remove the contents of the elements. Something like this should work:

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

I don't know what kind of structure you have, but I'm sure you could sneak this in before the CSS is loaded...

Edit

After reading the post linked by @zsong and this post here, you might end up breaking Angular trying to do this. Only one way to find out I guess!

链接地址: http://www.djcxy.com/p/18104.html

上一篇: notifyDataSetChanged()上的WinDeath

下一篇: 从html中删除角色评论