Angular pre-bootstrap (first screen) loader's animation freezes during initial loading

久未见 提交于 2019-12-07 05:33:12

问题


Simple demo here: https://plnkr.co/edit/IA0Bs5VH9WwVbLlKPQ6X?p=preview (I used the official angular.io/docs demo app)

The problem is: the first screen loader (I used loader.svg) animation freezes for a second during the initial loading of Angular App

The process goes like this: open the page, svg loader animation starts -> loader animation freezes -> loader animation re-starts -> angular app finish loading, loader hided

In this demo, the freeze is more obvious: http://iarouse.com/dist-angular2-material/v1/

<my-app>
  <!-- the loader -->
  <div id="loader-container"></div>
</my-app>

My real app is larger, and the initial loader animation freezes for a few seconds during bootstrap process, which is frustrating

Any thing I can do to make it smooth?


回答1:


I had your problem because I was rendering a gif spinner image. I tried the solution posted by @bviale and it worked.

Simply used the code founded in https://www.w3schools.com/howto/howto_css_loader.asp and putted between the app-root tag.



来源:https://stackoverflow.com/questions/43201592/angular-pre-bootstrap-first-screen-loaders-animation-freezes-during-initial-l

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!