angular-ui-router-styles
angular-ui-router-styles copied to clipboard
State loading synchronization
Hello @manuelmazzuola!
It's me back again )
I've encountered another issue with the module during it's use in one of our projects.
The problem is that the module loads stylesheets AFTER the state transition is complete and $viewContentLoaded event is triggered, i.e. when DOM of the view is compiled and rendered. Because of that some plugins are not working correctly, cause they need to know element dimensions during the initialization (and dimensions are not correct because stylesheets are not yet loaded).
I think that from conceptual standpoint view depends on CSS, so the CSS should be loaded prior to view being rendered and compiled.
Does it make sense to you? If so, we could think further of how we could improve this situation.
Hello @manuelmazzuola and @slavafomin
Same issue to me. There is always a "ugly time" before the css was loaded. I'm wondering is there any way to load the css file before the view is rendered.
There is a way to check if the css files are effectively loaded and fire an event, but, you have to wait for that event before rendering the template.
Hello @ming-body7 I've developed a module for Angular that tries to solve the problem of loading CSS dynamically, please have a look. It's kinda experimental, but we are using it in our production projects. It loads CSS during the resolve phase of the state transition and fires events when loading is started and finished.
@slavafomin Thanks for your remind! I will try it.