Whenever you have a global state that is reflected in a URL, you can use an ember router to manage that state.
For example, let's say you have a task resource embedded in a project, for example:
App.Router.map(function() { this.resource('project', { path: '/projects/:project_id' }, function() { this.route('edit'); this.resource('tasks', function() { this.route('new'); }); }); });
Ember will use the project_id project URL segment to find your model and set it as the contents of ProjectController. To access the currently selected project from another controller, declare the dependency using the needs array and access it using the controllers property.
App.TasksController = Ember.ArrayController.extend({ needs: ['project'] }); // tasks/index.hbs Project name: {{controllers.project.name}}
See controllers-needs-explained
source share