Reputation: 2209
I have a question about displaying the Array length in console.log().
Here is a simple example:
vm.list = CrudService.getAllData();
function getAllFonds() {
return ResService.names.query(
succResp,
errResp
);
}
function succResp(resp) {
return resp;
}
function ResService($resource, baseUrl) {
return {
names: $resource(baseUrl + '/api/list/:Id', {
Id: '@Id'
}, {
'update': {
method: 'PUT'
}
}),
....}
}
$log.info(vm.list);
When I'm opening the console, there will be display only:
Array [ ]
Only when I click on "Array" then I see on the right side that the array contains 47 objects.
Is there a possibility to display in console:
Array [47]
?
EDIT:
When I'm using:
$log.info(vm.list.length);
it returns 0.
Upvotes: 0
Views: 1797
Reputation: 723
I think you're looking for this:
console.log(vm.list.length);
or in your case
$log.info(vm.list.length);
Upvotes: 1