1
我想打我的控制器之前解决一个承诺阵列things
:解决与角UI路由器一个承诺阵列
resolve:{
things: function($q){
var promises = [];
var titles = [];
var thingRef = ['a1', 'a2', 'a3'];
angular.forEach(thingRefs, function(thingRef){
promises.push($firebase(ref.child('things').child(thingRef).child('title')).then(function(title){
titles.push(title);
}));
});
$q.all(promises).then(function(){
return titles;
});
}
},
什么我错在这里做什么?
我想,实际上,仍然没有骰子。 –
我做了一些额外的调整。如果这不起作用,你能告诉我承诺的输出和'$ firebase(ref.child('things')。child(thingRef).child('title'))''的结果。 – Halcyon
我被完全推迟了。我忘了注入'ref'。谢谢你的帮助! --- btw你确实需要'$ q.all()'' –