I searched for an answer to this first and found the following which I think was incorrectly closed:
<div class="medium-3 columns" ng-repeat="friend in data.friends.items | selectedFriendsCountries:friendsCountries" data-foundation-update>
<c:url value="friends-and-stories/friend/{{friend.code}}" var="url" />
<article class="promo-article-small row collapse">
<div class="medium-12 small-6 column promo-image-wrap">
<a href="${url}"><img class="promo-image" src="{{friend.primaryImageUrl}}"></a>
</div>
<div class="medium-12 small-6 column">
<a class="promo-block-link" href="${url}" data-equalizer-watch>
<header class="promo-header">
<h1 class="headline-tiny">{{friend.name}}</h1><span class="headline-tiny-thin">{{friend.profession}}</span>
</header>
<p class="promo-paragraph hide-for-small-only">{{friend.briefDescription}}</p>
</a>
<a class="link-article left-large" href="${url}">{{friend.linkLabel}}</a>
<feature:on feature="storefront.enable.site.ecommerce">
<a class="link-favorites right-large" href="${url}">
<i class="hl hl-heart-add hl-25"></i>
<span><spring:theme code="text.add" /></span>
</a>
</feature:on>
</div>
</article>
</div>
Filter:
filter('selectedFriendsCountries', function() {
return function(friends, friendsCountries) {
return friends.filter(function(friend) {
for (var i in friend.countries) {
if (friendsCountries.indexOf(friend.countries[i]) != -1) {
return true;
}
}
return false;
});
};
})
I want to update the foundation library so that my items get equalized height after ng-repeat has completed.
The problem, which was also mentioned in the other question, is that if you have a custom filter, then you cannot use a directive which checks for the $last iteration of the repeat if you add or remove items from the custom filters model.
How can one know when items have been iterated over using ng-repeat if you change the model of a custom filter?
Please do not close as a duplicate unless there is an answer
UPDATE:
Please see this FIDDLE which has an example of the issue.
You will see by default that "UK" is filtered and one person is showing. If you then click "Switzerland" it still works, but finally you choose "USA" and it fails, you no longer get the alert showing that we can find the scope.$last item.