I am struggling with the following code snippet in my Angular factory:
getPermissions: function(modelId){
var Pers = Permission.find({
filter : {
where : {
and : [
{
user_id : $rootScope.userId
},
{
permission_id : modelId
}
]
}
}
}, function(data){
var Pers = data;
});
console.log(Pers);
},
When I check the console, I see:
[$promise: c, $resolved: false]
Furthermore, when I try to use this code in my app function like so:
$scope.optionsCrud = getFoo.getPermissions(2);
console.log($scope.optionsCrud);
The console output is:
undefined
I am unable to iterate over the array. Does anyone have suggestions on how to fix this issue?