I have two controllers and I'm using a factory to declare objects. In the main controller I call the other like this:
var a = $controller('otherController', {$scope: $scope});
In the second controller, I have a function and I want to return an array to make something in the main
$scope.function = function(items){
//some data things
return auxItems;
};
The question is, in the main I call the function but I need the return to work. How can I "wait" the return in the main controller?