AngularJS:如何加载应用程序之前加载JSON提要? [英] AngularJS: How to load json feed before app load?

查看:191
本文介绍了AngularJS:如何加载应用程序之前加载JSON提要?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚学angularJS(采用了棱角分明种子),我需要的网站加载的其余部分之前从JSON加载进我的网站的配置。

I'm just learning angularJS (using angular-seed) and I need to load my site config from a JSON feed before the rest of the site loads.

不幸的是,使用$ http或$资源没有及时返回饲料应用的其余部分加载。

Unfortunately, using $http or $resource doesn't return the feed in time for the rest of the app to load.

什么是迫使应用程序应用程序的其他部分?

What is the correct way to force the app to load this data before the rest of the app?

推荐答案

您必须使用Controller.resolve方法。退房MISKO的(核心角开发商之一)回答 http://stackoverflow.com/a/11972028/726711

You have to use the Controller.resolve method. Check out Misko's (one of the core Angular developer) answer http://stackoverflow.com/a/11972028/726711

这篇关于AngularJS:如何加载应用程序之前加载JSON提要?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆