[FIXED] Retrieve Parse Query result from a .factory into a .controller

Hello everyone,

I’m new to Ionic and AngularJS in general, I was a backend dev before making the switch and I have a problem with an app I’m trying to develop:

I’m trying to get a result from a service into my $scope.variable in a controller, but I keep either getting undefined or creating some kind of error.

My service is very simple, it fetches a list from Parse.com
And my controllers needs to get that data to add it to the current $scope and work with it inside the controller

I’m adding a pen with both my service and my controller:

I can get this to work without the service, doing the Parse.Query from inside my controller and just doing an $scope.$apply to the result, but I do want to use it as a service because I’m going to be needing the same data in diferent controllers.

So if anyone can help me out with this I’ll be very grateful.

As a side note, I was checking out http://firebase.com and I see they have a library that works with AngularJS called angularfire, is it easier to integrate Ionic with Firebase? I’ve had lots of headackes using Parse :stuck_out_tongue:

It turns out I was just being a newbie:-)
@mhartington Helped me out on Slack and I was actually trying to return a value after the query.find when I needed to return the query-find itself.