Quantcast
Channel: Ember.JS - Latest topics
Viewing all articles
Browse latest Browse all 4829

How to pass parameters between different routes (in Ember 2.x)?

$
0
0

@ykaragol wrote:

First of all, I've asked the question at the SO at Sep 2. It didn't get enough attention.

While going from one route to another, I want to pass some data (especcially arrays). How is it possible?

I've found some solutions with drawbacks:

  • by using query-params: need to serialize, deserialize. Seems not suitable for different-sized arrays.

  • by using a service to store data: it is not only available to routes, but available to whole app. It can be modified unintentially. Also it will not have a garbage remove mechanism. It stores the values from routes that was displayed far before.

  • by using transition object as promise: It modifies the returning hash of model hook. Involves in someone else's business.

  • by using transition object's data attribute: It fits well. The only problem we found is: it is not working on page refreshs. (Of course page refresh means to reload the whole SPA. But it is totally acceptable from the users' perspective. Also using services may cause this problem.)

So, what is the suitable approach to passing parameters between different routes?

Posts: 3

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 4829

Trending Articles