ekousp
2014-08-22 11:52:59 +08:00
1. service 获取数据返回promise,在controller里 promise.then(...)
2. 使用 nv-view: resolve - {Object.<string, function>=} - An optional map of dependencies which should be injected into the controller. If any of these dependencies are promises, the router will wait for them all to be resolved or one to be rejected before the controller is instantiated. If all the promises are resolved successfully, the values of the resolved promises are injected and $routeChangeSuccess event is fired. If any of the promises are rejected the $routeChangeError event is fired.
3. 页面加载时先获取数据,然后手动启动bootstrap:
$.get('http://data').done(function() {
angular.boostrap(element, ['myapp']);
});