Ik heb uiteindelijk zowel de verzameling als de filtering doorstaan met hoekig:
Controller
angular.module("sushisushi24").controller("SearchRestaurantsCtrl",
function($scope, $stateParams, $meteor){
$scope.branches = $meteor.collection(Branches).subscribe('branchesAndRestaurants');
$scope.restaurants = $meteor.collection(Restaurants);
}
);
Meteoor publiceren
Meteor.publish('branchesAndRestaurants', function(opts) {
branches = Branches.find();
restaurantIds = branches.map(function(branch) { return branch.restaurantId });
return [
branches,
Restaurants.find({_id: {$in: restaurantIds}})
];
});
Bekijk
<div ng-repeat="branch in branches">
<div ng-repeat="restaurant in restaurants | filter: {_id:branch.restaurantId}">
<h3>{{restaurant.name}}</h3>
</div>
<address>{{branch.address}}</address>
</div>