Angular: Empty Fiddle
http://angularjs.org/
HTML
<script src="http://code.angularjs.org/angular-1.0.1.js"></script>
<div ng-controller="MyCtrl">
<p>List all connections regardless of customer association:</p>
<ul>
<li ng-repeat="connection in connections()">
{{connection.type}} :: {{connection.name}}
</li>
</ul>
</div>
JavaScript
var myApp = angular.module('myApp',[]);
//myApp.directive('myDirective', function() {});
//myApp.factory('myService', function() {});
function MyCtrl($scope) {
$scope.customers = [
{ name: "Cust A", connections: [
{ type: "Indi", name: "Conn A" },
{ type: "Business", name: "Conn B" }
]},
{ name: "Cust B", connections: [
{ type: "Indi", name: "Conn C" },
{ type: "Business", name: "Conn D" }
]}
];
$scope.connections = function() {
var connections = [];
$scope.customers.forEach(function(obj) {
connections = connections.concat( obj.connections );
});
return connections;
};
}