用于加载消息的ng-cloak相反 [英] Opposite of ng-cloak for loading message

查看:77
本文介绍了用于加载消息的ng-cloak相反的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道AngularJS框架中是否存在这种情况,但实质上我正在寻找与ng-cloak相反的东西,它隐藏元素直到编译页面。我正在寻找一种方法来显示全屏加载消息,直到页面编译。语言中是否有内容来处理这个问题?

I don't know if this exists in the AngularJS framework, but essentially I'm looking for the opposite of ng-cloak, which hides elements until the page is compiled. I was looking for a way to show a full screen loading message until the page is compiled. Is there something built into the language to handle this?

推荐答案

我已经使用一种有点hacky的方法解决了这个问题,如下所示。在主页末尾添加以下HTML。

I have resolved this using a somewhat hacky method as follows. The following HTML is added at the end of the main page.

<div ng-show="::false" style="position: fixed; height: 100%; width: 100%; background-color: #353535; top: 0; left: 0; z-index: 10000;">
    <div style="display: table; margin: 0 auto; font-size: 26px; color: #CCC;">
        Loading
    </div>
</div>

在整个浏览器中显示消息,直到页面被编译,此时ng-show需要结束并隐藏加载消息。

The message is shown across the entire browser until the page is compiled, at which point ng-show takes over and hides the loading message.

编辑:
Angular 1.3+允许您使用 :: 表达式,以防止在每个摘要周期中计算表达式。
https://docs.angularjs.org/guide/expression#one-time-binding

Angular 1.3+ lets you use the :: expression to prevent evaluating the expression in every digest cycle. https://docs.angularjs.org/guide/expression#one-time-binding

这篇关于用于加载消息的ng-cloak相反的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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