为什么 angular js 没有立即加载,加载需要时间
why angular js not loads instantly, it takes time to load
这是用于构建我的项目的演示:
https://material.angularjs.org/HEAD/demo/
我更改了很多菜单,但页面标题和数据保持不变。我面临与演示中相同的问题。浏览器不会立即呈现页面,但在显示元素内容之前需要一些时间。
你的问题不清楚!但是从您所面临的情况来看,您的 one/more 服务调用需要时间来最初获取数据,这可能会使您的应用程序变慢。在开发工具中转到网络并检查哪个服务占用了大量时间!
您可以使用 ngCloak 来防止这种情况发生。将 ng-cloak
放在您的 body 标签上并按照文档进行操作。
When this css rule is loaded by the browser, all html elements (including their children) that are tagged with the ngCloak directive are hidden. When Angular encounters this directive during the compilation of the template it deletes the ngCloak element attribute, making the compiled element visible.
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.
这是用于构建我的项目的演示:
https://material.angularjs.org/HEAD/demo/
我更改了很多菜单,但页面标题和数据保持不变。我面临与演示中相同的问题。浏览器不会立即呈现页面,但在显示元素内容之前需要一些时间。
你的问题不清楚!但是从您所面临的情况来看,您的 one/more 服务调用需要时间来最初获取数据,这可能会使您的应用程序变慢。在开发工具中转到网络并检查哪个服务占用了大量时间!
您可以使用 ngCloak 来防止这种情况发生。将 ng-cloak
放在您的 body 标签上并按照文档进行操作。
When this css rule is loaded by the browser, all html elements (including their children) that are tagged with the ngCloak directive are hidden. When Angular encounters this directive during the compilation of the template it deletes the ngCloak element attribute, making the compiled element visible.
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.