var app = angular.module('plunker', []);
app.controller('MainCtrl', function($scope) {
$scope.name = 'World';
$scope.clients = [
{'client_id' : '1', 'client_name' : 'Anne'},
{'client_id' : '2', 'client_name' : 'Tim'},
{'client_id' : '3', 'client_name' : 'John'}
];
$scope.courses = [
{'ordered_by' : '1', 'course_name' : 'Marketing'},
{'ordered_by' : '1', 'course_name' : 'Project Management'},
{'ordered_by' : '1', 'course_name' : 'Analytics'},
{'ordered_by' : '2', 'course_name' : 'Big Data'},
{'ordered_by' : '2', 'course_name' : 'Data Visualization'},
{'ordered_by' : '3', 'course_name' : 'PHP'}
];
});
<!DOCTYPE html>
<html ng-app="plunker">
<head>
<meta charset="utf-8" />
<title>AngularJS Plunker</title>
<script>
document.write('<base href="' + document.location + '" />');
</script>
<link rel="stylesheet" href="style.css" />
<script data-require="angular.js@1.5.x" src="https://code.angularjs.org/1.5.8/angular.js" data-semver="1.5.8"></script>
<script src="app.js"></script>
</head>
<body ng-controller="MainCtrl">
<p>Course list:</p>
<div ng-repeat="person in clients">
<strong><h2>{{person.client_name}} (ID: {{person.client_id}})</h2></strong>
<ul>
<!-- I wish it was this simple:
<li ng-repeat="course in courses | filter : {'ordered_by' : '{{person.client_id}}' }"> -->
<li ng-repeat="course in courses | filter : {'ordered_by' : '' }">
{{course.course_name}}<br><span>(Ordered by person with the ID: {{course.ordered_by}})</span>
</li>
</ul>
</div>
</body>
</html>
/* Put your css in here */
span {
font-size: 0.8em;
color: silver;
}