Example JSON Structure
{
"holding": [
{
"company": 1,
"employee": [
{ "id": 1, "name": "John"},
{ "id": 2, "name": "Michael"},
{ "id": 3, "name": "George"}
]
},
{
"company": 2,
"employee": [
{ "id": 1, "name": "Madonna"},
{ "id": 2, "name": "Harry"}
]
}
]
}
The structure above is available in the view as
{{ holding }}
Holding has 5 employees, how can I detect this in Angular? Is there a simple method? I need this possibility in the View, something like
{{ holding.length }} // 2
What I need is (PSEUDO CODE):
{{ length of all employees in holding }} // 5
If possible: I need a view-only-solution, that doesn't modify the controller..
Controller-solutions below (answers) do work properly.