ember.js - EmberJS - How to display subset of a model in a view -
i new (started today) ember , cannot figure how how set in correct manner.
models:
post, comment
on 'show' template post, want display comments not blocked (isblocked attribute of comment model). should use view , pass in param filter out comments?
i cannot find useful example or tutorial explains this. there way similar how done in rails partials , locals or something?
you can use computed property uses filterproperty
filter model inside controller. use computed property display in template.
assuming comment
model has isblocked
attribute, can set computed property like,
comments: function() { return this.filterproperty('isblocked', false); }.property('@each.isblocked')
then in template use comments
collection iterate over. comments collection have comments except isblocked
true.
Comments
Post a Comment