How to return a promise composed of nested models in EmberJS with EmberData?

后端 未结 2 370
遇见更好的自我
遇见更好的自我 2020-12-30 12:19

Enviroment

# Ember       : 1.4.0
# Ember Data  : 1.0.0-beta.7+canary.b45e23ba

Model

I have simplified my use case to make the q

2条回答
  •  无人及你
    2020-12-30 12:37

    What you could do instead:

    If you're here, you're probably doing the same mistake as I did :)

    If you need a complicated tree of objects to display your route, you could also:

    • If you use RESTAdapter you could sideload data in one HTTP request.
    • If you use FixturesAdapter (eg. in development phase) with a fixed set of data, you could switch to LocalStorageAdapter - as when you request a model, it loads all the associated models. So it will be as easy as a simple this.store.find('mymodel', model_id)

    However I'm leaving the original anwser marked as "accepted" as it actually anwsers the original question, and this anwser is just a note for future reference/other users.

提交回复
热议问题