问题:
I am wondering if there is a way (similar to Gmail) for AngularJS to delay showing a new route until after each model and its data has been fetched using its respective services. 我想知道AngularJS是否有一种方法(类似于Gmail) 延迟显示新路由,直到每个模型及其数据已使用其各自的服务获取 。
For example, if there were a ProjectsController
that listed all Projects and project_index.html
which was the template that showed these Projects, Project.query()
would be fetched completely before showing the new page. 例如,如果有一个ProjectsController
列出了所有Projects和project_index.html
,它们是显示这些Projects的模板, Project.query()
将在显示新页面之前完全获取。
Until then, the old page would still continue to show (for example, if I were browsing another page and then decided to see this Project index). 在此之前,旧页面仍将继续显示(例如,如果我正在浏览另一个页面,然后决定查看此项目索引)。
解决方案:
参考一: https://stackoom.com/question/oETC参考二: Delaying AngularJS route change until model loaded to prevent flicker