I have a function with this in:
1: var object = get_resource($scope, CbgenRestangular, $stateParams.scheme_id);
2: console.log(object)
Which runs this:
get_resource = function ($scope, CbgenRestangular, id){
CbgenRestangular.one('scheme', id).get().then(function(object){
console.log(object)
return object
})
},
My issue is that within get_resource
function console.log
returns the object perfect, however line 2 in the above code it's undefined
, why?
This should be the same object thats in the get_resource
function, why is it undefined when I return it.