I currently have a post stored in $scope.mydata within the controller. I pass this data as a parameter to a service that returns a function.
The service looks like:
module.factory('myservice', function () {
return function servicefunction(mydata) {
var test = _.keys(mydata).length;
console.log("mydata", mydata);
console.log("test", test);
Using Firebug in Firefox, it shows me that mydata
contains:
Object { $$state={...}, angularCollection=false, $object={...}, more...}
and the test result is 5.
However, when I try this code:
module.factory('myservice', function () {
return function servicefunction(mydata) {
var test = _.keys(mydata.$$state).length;
console.log("mydata", mydata.$$state);
console.log("test", test);
Firebug now displays Object { status=0}
with a status and value []
. I am trying to access that value
. The test result is 1 for the status.
I'm puzzled as to why the test using _.keys finds the status but not the value?