I have a notifications model for notifications
// MODEL
NotificationModel = App.BB.Model.extend({
defaults : {}
});
// COLLECTION
NotificationCollection = App.BB.Collection.extend({
model: NotificationModel,
url: '/notifications',
initialize : function() {
var me = this;
me.fetch();
}
});
The collection is fetching from the server correctly and has the following fields (id, read) where read is true or false.
How can I get the total number count of items that are read == false? … Unread item count?
Thanks
A structured solution would be to create these methods in your collection:
If you need the count, you can just add
.lengthto the end of the method.