Angular app需要一段时间来应用CSS

时间:2022-04-24 18:36:30

The angular app that I am working on takes a while to apply the CSS. When any page first loads (or from refresh), everything is displayed as raw html (unordered lists, etc) like : Angular app需要一段时间来应用CSS

我正在处理的角度应用程序需要一段时间才能应用CSS。当任何页面首次加载(或从刷新)时,所有内容都显示为原始html(无序列表等),如:

Here is the network log : Angular app需要一段时间来应用CSS Angular app需要一段时间来应用CSS Angular app需要一段时间来应用CSS

这是网络日志:

Not sure what the root cause of this is and what the best way to resolve it would be.

不确定这是什么原因以及解决问题的最佳方法是什么。

1 个解决方案

#1


1  

The best way to resolve it is to use a loading .gif which will be displayed until all elements of the page have been loaded.

解决它的最佳方法是使用加载.gif,它将显示,直到页面的所有元素都已加载。

HTML

<!-- Loading div with some CSS and possibly text to let the user know the page is loading -->
<div class="loading"></div> 

<!-- Content div which will have the hidden class removed after the page has been fully loaded and rendered -->
<div class="content hidden"></div>

When the hidden class is removed from .content, it should be applied to .loading.

当隐藏类从.content中删除时,它应该应用于.loading。

#1


1  

The best way to resolve it is to use a loading .gif which will be displayed until all elements of the page have been loaded.

解决它的最佳方法是使用加载.gif,它将显示,直到页面的所有元素都已加载。

HTML

<!-- Loading div with some CSS and possibly text to let the user know the page is loading -->
<div class="loading"></div> 

<!-- Content div which will have the hidden class removed after the page has been fully loaded and rendered -->
<div class="content hidden"></div>

When the hidden class is removed from .content, it should be applied to .loading.

当隐藏类从.content中删除时,它应该应用于.loading。