简体   繁体   English

防止在角度加载之前的瞬间对绑定和指令可见的正确方法是什么?

[英]What is the proper way to prevent bindings and directives from being visible for the split second before angular is loaded?

When my app loads, angular directives and bindings are visible for a slight moment before Angular consumes them. 加载我的应用程序后,在Angular使用它们之前,会显示一会儿角度指令和绑定。 This is distracting and looks unprofessional, and I fear it may leave an unpleasant mark on my visitors. 这令人分心,看起来不专业,我担心它可能会给我的访客留下不愉快的印记。

What is the proper way to avoid this, besides the obvious solution of putting the Angular loading script into the head and blocking the render of the rest of the page? 除了将Angular加载脚本放入头部并阻止页面其余部分的呈现的明显解决方案之外,还有什么避免这种情况的正确方法?

You should use either ngBind or ngCloak. 您应该使用ngBind或ngCloak。

See ngBind API / ngCloak API 请参阅ngBind API / ngCloak API

http://docs.angularjs.org/api/ng.directive:ngCloak http://docs.angularjs.org/api/ng.directive:ngCloak

Try the ng-cloak directive. 尝试ng-cloak指令。 Docs state is just for this situation. 文件状态仅适用于这种情况。 I've used it without loading angular in the head as well. 我使用它时也没有在头部加载角度。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在重定向到登录之前,阻止Angular站点上的未授权用户暂时查看站点的最佳方法是什么? - Best way to prevent unauthorized user on Angular site from seeing site for a split second before being redirected to login? 在 angular js 指令中使用 jquery 的正确方法是什么? - what is proper way to use jquery in angular js directives? 在另一个脚本之前等待完全加载的脚本的正确方法是什么 - What is the proper way to wait a script loaded completely before another JavaScript:防止在加载整个页面之前按下按钮 - JavaScript: Prevent a button from being pressed before entire page is loaded 在加载的脚本中,在.ready回调之前调用JQuery .load回调,初始化加载的脚本的正确方法是什么? - JQuery .load callback is called before .ready callback in loaded script, what is proper way of initialization loaded scripts? 使用Angular伪指令加载部分内容不会在第二次加载视图时呈现 - Loading partial with Angular directives not rendering the second time the view is loaded Angular 1.5自定义指令未在本机​​angular指令之前执行 - Angular 1.5 custom directive not being executed before native angular directives 如何防止查询字符串值可见 - how to prevent querystring values from being visible 在将数据加载到 this.state(即在 componentDidMount 中)之前,如何防止函数运行? - How do I prevent a function from being run before data is loaded into this.state (i.e. in componentDidMount)? 使用 Angular 组件/指令绑定的最有效方法是什么? - What's the most efficient way to use Angular component/directive bindings?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM