I initialise the View:
notifications = new tvr.notifications.Collection
notifications.fetch()
new tvr.notifications.View collection:notifications
Im adding "notifications" to a backbone collection:
notifications = new tvr.notifications.Collection
notifications.fetch()
notifications.create html:this_notification
notifications.coffee
class Notifiction extends Backbone.Model
class Notifictions extends Backbone.Collection
model = Notifiction
localStorage: new Backbone.LocalStorage 'tvr.notifications'
class NotificationView extends Backbone.View
initialize: ->
@listenTo @collection, "add", @update
update: ->
alert "update"
namespace 'tvr.notifications', (exports) ->
exports.Model = Notifiction
exports.Collection = Notifictions
exports.View = NotificationView
this events are never called, I can see the objects created in the collection.
I just want to know when A new one is added, or deleted from the collection, so I can update a badge number in the HTML.