如果在 DomContentLoaded 中初始化,为什么要在底部声明 AngularJs
Why declare AngularJs at the bottom if it's initialised in DomContentLoaded
https://docs.angularjs.org/guide/bootstrap
本指南中说 "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"
但是在下一个语句中它到底是什么意思"Angular initializes automatically upon DOMContentLoaded event"。谁能解释一下这个初始化的意思,然后 angular.js 如何阻止 HTML 加载?
当 HTML 解析器遇到任何脚本元素时,它假定 document.write
可能出现在脚本中并阻止 HTML 加载。这就是为什么建议在页面底部加载所有脚本以确保快速加载页面。
声明 Angular initializes automatically upon DOMContentLoaded event
,这意味着 angular 在 DOM 准备就绪后启动应用程序。
https://docs.angularjs.org/guide/bootstrap
本指南中说 "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"
但是在下一个语句中它到底是什么意思"Angular initializes automatically upon DOMContentLoaded event"。谁能解释一下这个初始化的意思,然后 angular.js 如何阻止 HTML 加载?
当 HTML 解析器遇到任何脚本元素时,它假定 document.write
可能出现在脚本中并阻止 HTML 加载。这就是为什么建议在页面底部加载所有脚本以确保快速加载页面。
声明 Angular initializes automatically upon DOMContentLoaded event
,这意味着 angular 在 DOM 准备就绪后启动应用程序。