serialization - Passing async 'hasMany' relation to a component -
i have ember model 'hasmany' relation don't want embed, , need pass asynchronously component gets records relation. when call component emblem file (=user-answer useranswers=useranswers id=smth.id
), error "no method 'get' undefined". here code:
app/models/quiz_progress.coffee:
`import ds "ember-data";` `import progressmixin "../mixins/progress_mixin"` quizprogress = ds.model.extend progressmixin, useranswers: ds.hasmany 'user_answer', async: true `export default quizprogress;`
app/components/user-answer.coffee:
`import ember "ember";` useranswercomponent = ember.component.extend tagname: 'div' classnames: ['ui', 'list'] useranswer: (-> id = @get('id') answers = @get('useranswers') answers.findby('questionid', id).get('answers') ).property('id', 'useranswers') `export default useranswercomponent;`
and works when useranswers serialized embedded. there no way rid of embedding? want pass ids
Comments
Post a Comment