A
A
AleshaOleg2014-07-09 19:11:41
Ember.js
AleshaOleg, 2014-07-09 19:11:41

How, in a one-to-many relationship, fill in an array that defines what needs to be displayed for specific data in Ember.js?

I can not find in any way on stackoverflow and in google how to add to the array that controls the display of data, in a one-to-many relationship in ember.js. Code is here . Also, I want to understand how to make comments only for it for each individual match page. Anyone can help me?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Artur Smirnov, 2014-07-28
@artursmirnov

After reviewing your code, I have the impression that you do not understand very well how Ember works. I would suggest reading the full official Ember Guide if you haven't already. In particular, if you inherit the controller from `Ember.ObjectController`, you do not need to get the model and access its properties directly - the ObjectController proxies the properties from the model to itself. That is, you can just write `this.get('comments')`.
In addition, I saw in your model for `Comment` the connection `Comment.match`. But when creating a comment, it is not set. Therefore, the comments do not know which matches they refer to.
In addition, I want to say that storing all controllers / models / routes in one file is bad. They are hard to find and read. Try to installYeoman and from it - Ember Generator . It will create the correct project structure. In this form, it will be easier to develop and maintain.

Similar questions

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question