I am using loopback to read list/array of customers. I stored customer array in $scope.customers.customerList. When I first log, the array seems fine but when I get its length, it seems to get lost because it returns 0. Why is that happen?
Here is my code:
$scope.customers = { customerList: [] };
var filter = {
include: {
relation: 'orders'
}
};
$scope.customers.customerList = Customers.find({filter: filter});
console.log($scope.customers.customerList); //outputs array with length 21
console.log($scope.customers.customerList.length); //array length is 0
Link: screenshot of the output