ng-show在页面加载完成之前显示内容? [英] ng-show display the contents before the page finished loading?

查看:39
本文介绍了ng-show在页面加载完成之前显示内容?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用这种非常简单的方法在隐藏和显示某些内容之间切换:

I'm using this very simple approach to toggle between hiding and showing some contents:

<a ng-click="cred=!cred" href="javascript:void(0)" style="text-decoration:none;"><strong>Admin Credentials</strong></a><br />
<p class="lead check-element animate-show-hide" ng-show="cred">User Name: <strong>Mohamed</strong><br /> Password: <strong>password</strong></p>

控制器尚无代码.但是我注意到页面加载时,类 lead 的内容显示了几毫秒,然后消失了?但这不是我所需要的,任何人,我想.我希望它最初是隐藏的,但似乎angular正在等待页面完成加载,然后应用了 ng-show 表达式!

The controller has no code yet. but I noticed that when the page is loading, the contents of the class lead are showing for milliseconds and then it disappear? but that is not what I need, either anyone- I think. I want it to be initially hidden, but it seems that angular is waiting for the page to finish loading and then it applies the ng-show expression!

推荐答案

如果不需要,ng-show项会在加载前闪烁.

ng-show items flash before loading if they aren't required.

ng-cloak和必要的CSS对其进行隐藏.

ng-cloak along with the necessary CSS should be used to hide them until it is known whether or not the element is needed.

    [ng\:cloak], [ng-cloak], .ng-cloak {
        display: none !important;
    }

这篇关于ng-show在页面加载完成之前显示内容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆