ember.js - Ember-cli , how do i change rest call on fly in the rest adapter -


im working on ember-cli, how change rest call on fly in rest adapter. if use path params not query params?for example:

export default ds.restadapter.extend({      namespace:'res/v1/users/id',      pathfortype: function() {          return ember.string.underscore("friends");},}); 

based on user selection dropdown "id", using id need user friends database. please suggest better way do. aapplication supports pathparams not query params

to customize url, override buildurl method in adapter.

the tricky part access related records adapter. example, request friends given user. work in friend adapter, need know user's id include in url.

for purpose, use record property on snapshot argument of buildurl method.

alternatively, might want override of buildurl's underlying methods such urlforfindquery, depending on how request model store. find.query(), retrieve id of user query.

if not you, please respond way you're trying fetch friends store.


Comments

Popular posts from this blog

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -

javascript - oscilloscope of speaker input stops rendering after a few seconds -