[英]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
Please use ngCloak directive 请使用ngCloak指令
http://docs.angularjs.org/api/ng.directive:ngCloak http://docs.angularjs.org/api/ng.directive:ngCloak
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.