防止双花括号符号在 angular.js 编译/插入文档之前暂时显示 [英] Prevent double curly brace notation from displaying momentarily before angular.js compiles/interpolates document

查看:14
本文介绍了防止双花括号符号在 angular.js 编译/插入文档之前暂时显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当需要加载大量图像/脚本时,这似乎主要是 IE 中的一个问题,标记中的文字 {{stringExpression}} 可能有很多时间显示,然后在 angular 完成文档的编译/插值后消失.

It seems to be primarily an issue in IE when there is a number of images/scripts to load, there can be a good amount of time where the literal {{stringExpression}} in the markup are displayed, then disappear once angular is done with it's compilation/interpolation of the document.

发生这种情况是否有一个共同的原因,表明我在做一些普遍错误的事情,或者是否有已知的方法可以防止这种情况发生?

Is there a common reason why this would happen which would indicate I'm doing something generally wrong, or is there a known way to prevent this?

推荐答案

我认为您正在寻找 ngCloak 指令:https://docs.angularjs.org/api/ng/directive/ngCloak

I think that you are looking for the ngCloak directive: https://docs.angularjs.org/api/ng/directive/ngCloak

来自文档:

ngCloak 指令用于防止 Angular html 模板浏览器以原始(未编译)形式简要显示在您的应用程序加载时形成表单.使用此指令可以避免html模板显示引起的不良闪烁效果.

The ngCloak directive is used to prevent the Angular html template from being briefly displayed by the browser in its raw (uncompiled) form while your application is loading. Use this directive to avoid the undesirable flicker effect caused by the html template display.

该指令可以应用于 元素,但首选用法是应用多个 ngCloak指令到页面的一小部分,以允许浏览器视图的渐进式呈现

The directive can be applied to the <body> element, but the preferred usage is to apply multiple ngCloak directives to small portions of the page to permit progressive rendering of the browser view

这篇关于防止双花括号符号在 angular.js 编译/插入文档之前暂时显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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