If you return a promise from beforeModel
, the transition will pause until the promise fulfills.
I can't speak to whether that will solve your specific problem, but that's how beforeModel
works.
题
I need to add spinning loader to component. My component observing global object global.loading
. I'm setting global.loading
to true
in beforeModel
hook in my route
.
The problem that there is some sort of race-condition: UI thread gets blocked by the model before loading spinner appears.
Is there any way i can delay model from beforeModel
?
Or i need to come up with different strategy?
解决方案
If you return a promise from beforeModel
, the transition will pause until the promise fulfills.
I can't speak to whether that will solve your specific problem, but that's how beforeModel
works.