我已经构建了一个Angular App,它现在被转换为一个用于服务器端渲染的Angular Universal。然而,现在,当应用程序加载时,它首先加载UI,同时它还在加载所有核心.js文件(main.1a23s..js)
最初的预加载完美地覆盖了内容,就像这里所描述的那样- Pre-Bootstrap Loading Screen For Angular2然而这种方法似乎不再有效?
发布于 2018-10-06 05:12:17
Hacky工作解决方案
// Listen for the event before bootstrapping:
document.addEventListener('DOMContentLoaded', () => {
platformBrowserDynamic().bootstrapModule(AppModule)
.then(()=>{
console.log("LOADED")
document.querySelector('.loading').classList.add('trans-out')
})
.catch(err => console.log(err));
});https://stackoverflow.com/questions/52671661
复制相似问题