angularjs - 防止在 angular.js 编译/插入文档之前暂时显示双花括号符号

标签 angularjs

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

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

最佳答案

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

来自文档:

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.

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

关于angularjs - 防止在 angular.js 编译/插入文档之前暂时显示双花括号符号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12866447/

相关文章:

javascript - Angularjs 模型未在嵌套 ng-repeat 内更新

javascript - 同时多次调用同一服务

angularjs - 如何将 Stripe 信用卡字段与 `ng-disabled` 的 `button` 属性集成?

javascript - 如何在Firebase中制作特定的架构?

javascript - Angular : automatically detect change in model

javascript - 如何设计 NVD3 图表的工具提示样式?

angularjs - 为在 IIS 上运行的 Angularjs 应用程序配置预渲染 io

javascript - 如何向现有对象添加原型(prototype)属性

javascript - 调用服务时检索 Controller 中的值并将我们从服务接收到的值返回到 Controller

javascript - 在我的案例中如何禁用表单提交