What you have here is a promise, which will return you values asynchronously(i.e out of the flow of execution). The correct way to handle this is as follows:
promiseObj.then(function(value){//you're code here})
When i was staring out this here helped me understand promises.
http://andyshora.com/promises-angularjs-explained-as-cartoon.html
Hope this helps,
Cheers!