Through much looking and trying, I believe there is no way to return a value from an ajax request in an Emberjs help. (I hope I am wrong.) I believe the reason is the whole ansyc callback thing.
So this is my dilemma;
I have a parent model A that has children of model B. I would like to display the parent and the children together with some extra information. The extra information is coming from an api call that is using some of model B's information. I am not saving this extra information on model B, but I would like to display it. So basically, I have something like this:
{{#each modelb in modela.modelbs}}
...
{{/each}}
I would love to be able to do something like:
{{#each modelb in modela.modelbs}}
{{get-info modelb}}
{{/each}}
And it return the information that I am able to get from the api call.
I tried using a helper like I said before. I tried putting some logic in the controller, but I can not isolate individual child models to create a computed property. (plus I am not sure if a computerd property would help me, I think it needs a return statement, which puts me back in the same issue as a helper, and I do not think I can create a computed property on the child relationship.) And while I have the extra information I need from the api call, I have no way to associate it with my child model B.
I figure I am not thinking about this problem in the 'ember way'. Hopefully, there is a better way to go about this.
Any help would be greatly appreciated.
Aucun commentaire:
Enregistrer un commentaire