私anglar-ui-tree
は自分のプロジェクトで使用します。
companyEstimatedEarning
各ノードのすべてを合計するにはどうすればよいですか?
たとえば、company 1.1.1
- total=5
、company 1.1
- total=18
、company 1
-total=53
$scope.data = [{
'id': 1,
'title': 'company1',
'companyEstimatedEarning': 25,
'nodes': [
{
'id': 11,
'title': 'company1.1',
'companyEstimatedEarning': 13,
'nodes': [
{
'id': 111,
'title': 'company1.1.1',
'companyEstimatedEarning': 5,
'nodes': []
}
]
},
{
'id': 12,
'title': 'company1.2',
'companyEstimatedEarning': 10,
'nodes': []
}
]
}, {
'id': 2,
'title': 'company2',
'companyEstimatedEarning': 10,
'nodes': [
{
'id': 21,
'title': 'company2.1',
'companyEstimatedEarning': 15,
'nodes': []
}
]
}];