javascript - How to observe on properties and clear them on reload -
i'm reloading data view every 4 seconds this
var app = ember.application.create({ ready: function() { setinterval(function() { app.quotes.find().reload }, 4000); } });
and i'm fetching value in view this:
<blockquote> {{#each model}} <p>{{message}}</p> {{/each}} </blockquote>
question
every 4 seconds new request fired off rest api grab new quote. however, new quote getting appended existing quotes. how can overwrite old quotes , display new, changed, value?
see ember model reloading in interval , possibly make minor change:
didload: function(){ var self = this; setinterval(function() { self.clear(); // <- clears out existing record self.reload(); }, 4000); }
it's bit odd me doing in ember.application object instead of array controller. there reason doing this?
Comments
Post a Comment