dimanche 22 janvier 2017

Ember : Custom model URL specified per route param

In ember i have two models : game & game-config

and some routes in my api/ember app

/games
/games/:game_id
/games/:game_id/configs
/games/:game_id/configs/:id

1st route, i get all games from my api (GET /games)
2nd route, i get a single game (GET /games/1)
3rd route, i wanna get all configs for a game (GET /games/1/configs)
4th route, i wanna get a single config for a game (GET /games/1/configs/1)

How should i do my query using ember-data in this case ?

By default, my game-config model would query /game-config/{id} but here i need to custom my URL with params.

Is somebody have an idea ?

Thank you




Aucun commentaire:

Enregistrer un commentaire