问题描述
我有我只是想展示一个div元素,当我的项目列表为空。所以,我把以下内容(HAML):
I have a div element that I only want to be show when my list of items empty. So I put in the following(in haml):
#no-items.ng-cloak{ :ng_show => "items.length <= 0", :ng_cloak => true }
不过,我已经做了即使该元素仍然在屏幕上闪烁。然后我看到Angularjs - NG-斗篷/ NG-表演元件眨眼,但即使在加入我的CSS以下后,眨眼仍然出现
However, even after I've done that the element is still flashing on the screen. Then I saw Angularjs - ng-cloak/ng-show elements blink, but even after adding the following in my CSS, the blink still occurs.
[ng\:cloak], [ng-cloak], .ng-cloak {
display: none !important;
}
任何想法我做错了吗?
Any ideas what I am doing wrong?
推荐答案
在课上使用NG隐藏,JS将其关闭或重新设置它,即使它的存在,但直到JS踢它可以坐在那里,用CSS隐藏你的div
use a ng-hide in the class, JS will take it off or set it again even if its there but till JS kicks in it can sit there and use CSS to hide your div
<div data-ng-controller="RoomsController">
<div ng-cloak class="ng-cloak ng-hide" data-ng-if="visible" >
Some text
</div>
</div>
这篇关于NG-斗篷和NG-闪烁显示在屏幕上隐藏的元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!