ember.js - emberjs star/unstar items just in the memory -


i build basic emberjs app, app lists posts, , every post has star / unstar event.
list starred posts in sidebar, without server side communications. best way that? first idea that: create star action postscontroller, add starred posts array, , list array in template.

the simplest solution can think set attribute star on post model false default, can set star true when want , render in sidebar post filtered star attribute.

code (coffeescript) :

app.post = ds.model.extend   title: ds.attr('string')   star: false  app.post.reopenclass   stared: ->     @filter (post) -> post.get('star') true 

from can render app.post.stared() array in sidebar.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -