4
votes

Has anyone messed around with using a non-ID parameter with the new ember router?

Back with the older version of the router, it seemed like an easier thing to do, since you had access to the serialize and deserialize methods on a route. In effect you could theoretically deserialize a non-ID attribute of the model into the params hash, and you could serialize an object from that non-ID attribute using the deserialize and serialize methods on the route, respectively. From my understanding the serialize and deserialize methods are no longer public, which makes this a bit trickier to handle..

1

1 Answers

8
votes

With the new router, you still have access to serialization and deserialization.

  • deserialize has been renamed model, and it gets the params as a parameter. If you return an Ember Data object from model (or any other Promises/A+ compatible promise), the rest of the hooks will not run until the object has loaded.
  • serialize is still named serialize. It takes the model (the object passed to the linkTo helper or the transitionTo method) as its first argument, and should return a hash of parameters.