I have a custom data type Message:
function Message(body, author, date) {
this.body = body;
this.author = author;
this.date = date;
this.stars = [];
}
Message.prototype.hasStars = function() {
return this.stars.length !== 0;
};
I'm also doing a repeat on an array of these messages:
<li ng-repeat='message in messages | orderBy:"-stars.length"'>…</li>
How can I add a filter to it that calls message.hasStars()? I tried the following but none of them had effect:
message in messages | filter:message.hasStars() | orderBy:"-stars.length"
message in messages | filter:message:hasStars() | orderBy:"-stars.length"
message in messages | filter:message.hasStars | orderBy:"-stars.length"
message in messages | filter:message:hasStars | orderBy:"-stars.length"
filtermodule or just a function.