0

Just out of curiosity if I have a chat application with an unread message counter...

How do I reset that counter?

Simply put, when User A writes a message, B increments there unread counter. When B is on the message page, I would like to reset that counter each refresh of the messages (it is running on subscribe).

Any ideas?

msj121
  • 2,812
  • 3
  • 28
  • 55

2 Answers2

1

Actually it was pretty simple.

You can write the following code in your html:

{{yourMethodName();}}

Then in your server you write some code:

app.proto.yourMethodName = function(){
  //Clear data
  this.model.del("yourdata.count");
  //similar to: this.model.set("yourdata.count",0);
}

Super simple.... Updated based off of Aleksey

msj121
  • 2,812
  • 3
  • 28
  • 55
1

or this.model.del("yourdata.count");