关于 anguler official guide - bootstrap我阅读:
Place the script tag at the bottom of the page. Placing script tags at the end of the page improves app load time because the HTML loading is not blocked by loading of the angular.js script. You can get the latest bits from http://code.angularjs.org. Please don't link your production code to this URL, as it will expose a security hole on your site. For experimental development linking to our site is fine.
也在同一站点上 AngularJS ngCloack我阅读:
For the best result, the angular.js script must be loaded in the head section of the html document
我是angularjs的新手,我的问题是:
把angulas.js脚本放在body底部,让我的html非阻塞会遇到什么问题?我在哪里可以学习如何处理这个问题?谢谢大家!
最佳答案
主要问题是,如果您在底部加载脚本,那么要使 ng-cloak
正常工作,ng-cloak
类的 CSS 需要在顶部加载。
来自文档:
ngCloak
works in cooperation with the following css rule embedded withinangular.js
andangular.min.js
[ng\:cloak], [ng-cloak], [data-ng-cloak], [x-ng-cloak], .ng-cloak, .x-ng-cloak { display: none !important; }
For the best result, the
angular.js
script must be loaded in the head section of the html document; alternatively, the css rule above must be included in the external stylesheet of the application.
关于javascript - 如果把angular.js放在body底部会遇到什么问题?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35419075/