隐藏尖括号直到 javascript 加载 [英] Hide Angular brackets until javascript loaded
问题描述
我有一些像
这样的 HTML<p class="noresults">{{numberOfContacts}} 结果可用</p>
是否可以在 Angular 加载之前隐藏 {{numberOfContacts}}
?所以它只会说 Results Are Available
我似乎有一些解决方案,例如在 Angular 加载之前隐藏整个主体,但如果可能的话,我宁愿不这样做.
是的,使用 ng-披风.只需将 class="ng-cloak"
或 ng-cloak
添加到这样的元素
使用指令
使用类<div class="ng-cloak"></div>
这只是一组带有 display: none !important
的 CSS 规则,并且当 Angular 呈现您的 DOM 时,它会移除 ng-cloak,因此元素可见.
I have a few bits of HTML like
<p class="noresults">{{numberOfContacts}} Results Are Available</p>
Is it possible for me to hide {{numberOfContacts}}
until Angular has loaded? So it would just say Results Are Available
I've seem some solutions such as hiding the entire body until Angular has loaded, but I'd rather not do that if possible.
Yes, use ng-cloak. Simply add class="ng-cloak"
or ng-cloak
to an element like this
Using directive <div ng-cloak></div>
Using class <div class="ng-cloak"></div>
It's simply a set of CSS rules with display: none !important
and as Angular has rendered your DOM it removes the ng-cloak so an element is visible.
这篇关于隐藏尖括号直到 javascript 加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!