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

How do I handle needing the same model twice with a different dataset?

$
0
0

@sorvah wrote:

I have a section of my application that allows users to compare a model with mutable date parameters. At the moment my implementation of this is really poor and I’d like to see if anyone else has tackled the same problem.

At the moment I have a route calling two separate but identical models (dataGroup1, dataGroup2) and they display data based on their own queryParams (group1DateFrom, group2DateFrom etc). This means that I also have two separate but identical queries on the back end supporting these models.

It’s very clunky and involves a lot of repetition but I’m not sure how I can have two instances off the same model displaying different data (due to the queryParams). As far as I know the model can only be called once in the route.

I thought about potentially using named outlets to display the data for each group but they would still be generated by the single route. I also thought about calling the model twice in nested routes but as the models are brought from the store I don’t think this would work either.

Does anyone have any ideas on what the best Ember way would be to deal with this requirement?

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4829

Trending Articles