Open arnebit opened 6 years ago
Yes, I'm not really getting how this package can be used for an dynamic routing. We have
this.route('campaigns'); // this is the index, done before good Ember pattern of using index file
this.route('campaign', { path: 'campaign/:campaign_id' }, function() {
this.route('details');
});
And I want to alias the campaign
resource to be standardized plural if navigating within it:
this.alias('campaigns', 'campaigns/:campaign_id', 'campaign');
so I could go either /campaign/x/details
or /campaigns/x/details
.
...but in the alias, this fails to provide the expected modelFor('campaign')
. Not sure how to use this package for this at all.
Ultimately, I think this package should probably be deprecated.
When a route with subroutes has an alias, then accessing the parent model in a subroute via
this.modelFor
requires knowing whether the route was accessed via the alias or the original name.Moreover, transitioning between
/one/a
and/alias-one/a
re-triggersone
'smodel
hook andthis.modelFor('one')
in...routes/one/a.js
will still return the old model hook result (i.e. from the previous transition to/one/a
).Testcase: Add two files:
Then show the model in
tests/dummy/app/templates/a.hbs
(and possiblyalias-a.hbs
), e.g. by adding<em> {{model}} </em>
and navigate a bit between /one/a, alias-one/a and other routes.Here, too, I am not sure this behaviour can be mitigated, but since I found it quite astonishing I would have preferred to learn about it from the readme.