简体   繁体   中英

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. 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?

You should use either ngBind or ngCloak.

See ngBind API / ngCloak API

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

Try the ng-cloak directive. Docs state is just for this situation. I've used it without loading angular in the head as well.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM