Reputation: 3
I have this on my router.js:
this.resource('campaigns', {path:'/campaigns'}, function() {
this.route('index', {path: '/'});
this.route('group', {path: '/*campaign_group_id'});
});
So it's a route called campaigns, and 2 nested routes: index and group.
When the browser is on the group route, I need to access the model from group route, on the campaigns route/controller.
But I can't access it. I always get the model that it's on campaigns.js route.
Upvotes: 0
Views: 291
Reputation: 12684
If you set the model from the campaign.group
route on its controller, you should be able to use controllerFor
to from the campaigns
route, something like
// routes/campaigns.js
this.controllerFor('campaigns.group').get('your-prop')
You could also send an action from your group
route and handle it in the parent campaigns
route, sending along the model. This is perhaps more idiomatic with Ember 2.0 conventions.
Btw if you're using Ember CLI (which you should be) you should try getting rid of this.resource
and putting all your routes/templates/controllers in pods.
Upvotes: 1