5 ms·
Hi there. I omitted the hashbang just because I find it ugly. > Loading those other routes first either loads data or modifies the state of the application in
by aokolish 12y ago
Hi there. I omitted the hashbang just because I find it ugly.
> Loading those other routes first either loads data or modifies the state of the application in a way that is required to display that route
That should be a non-issue as far as I understand, because visiting a nested route causes the parent route code to be executed first. Hence, the confusion.
- pyre 12y agoYes and no. Depends on how the routes are structured in the code. In your example: /users/ /users/15/ /users/15/photos/ Your router map probably looks like this: App.Router.map(function() { this.route('index', { path: '/' }); this.resource('users', { path: '/users' }, function () { this.route('index', { path: '/' }); this.route('show', { path: '/:user_id' }); this.route('photos', { path: '/:user_id/photos' }); }); }); This translates into a structure like: ApplicationRoute IndexRoute UserRoute UsersIndexRoute UserShowRoute UserShowPhotosRoute Note how all of those Users*Route classes are all siblings rather than in parent-child relationships. Also note that if you're sharing controllers, they won't pass through Route.setupController on the sibling routes because those routes aren't run.