Skip to content Skip to sidebar Skip to footer

Passing A Dynamic Parameter Different Than Xyz_id Using LinkTo In Ember.js

I've seen a lot of examples of passing dynamic parameters which end with xyz_id being passed where xyz is the 'model'. However, is there a way to pass an id different than xyz_id?

Solution 1:

I figured it out. Had to implement the serialize method on the router:

serialize: function(model, params) {
    return {
        code: model.code,
        type: model.type,
        id: model.id
    };
}

and of course, update the according path:

this.resource('video', {
    path: '/video/:type/:code'
});

http://jsfiddle.net/xcNSa/12/


Post a Comment for "Passing A Dynamic Parameter Different Than Xyz_id Using LinkTo In Ember.js"