这里有一个小问题,我有一个与工厂通信的控制器,但是如何将工厂结果传递给函数?我试过的东西:
.controller('testCtrl', ['$scope', 'foo', 'boo', function($scope, foo, boo){
foo.get().then(function(response){
$scope.foo = response;
});
boo.get().then(function(response){
$scope.boo = response;
});
// Why this will not work?
function test(){
var getFoo = $scope.foo;
var getBoo = $scope.boo;
};
}]
上面的例子不起作用,我怎样才能得到这个工作?
谢谢。