如果我把angular.js放在body底部会遇到什么问题?
What problems I will face if I put angular.js at the bottom of the body?
在 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脚本放在正文底部可能会遇到什么问题,让我的html非阻塞?我在哪里可以学习如何处理这个问题?谢谢大家!
主要问题是,如果您在底部加载脚本,那么 ng-cloak
才能正常工作, ng-cloak
类 的 CSS 需要在顶部加载。
来自文档:
ngCloak
works in cooperation with the following css rule embedded within angular.js
and angular.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.
在 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脚本放在正文底部可能会遇到什么问题,让我的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.