問題:
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