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

Linking To Unresolved Subroutes

$
0
0

I have some routes

/teams
/team/:team_id
/team/:team_id/members

Many users only have one team, so they should be able to be linked to their team route. If not, a list of teams is displayed, which link to the /team/:team_id route.

I’m currently handling this with a combination of

  • a Route.redirect hook (if they only have one team, go to the team/:id route) and
  • a list of <LinkTo>s for each team with a dynamic route (either the default destination [/team/:id] or the parameter passed from the redirect param).

I was thinking about adding a redirect query param, but didn’t know if that should be:

  • team.members
  • members
  • /team/:team_id/members
  • .members
  • /members

First, whether to use / (URL convention) or . (Ember convention). Also, whether to include the current path as part of the direct (with a leading dot or slash). Plus, I can see a future need for query params on the team.members route soon (ex /team/:team_id/members?status=inactive).

This seemed to be a perfect fit for RouterService.recognize, but the missing params means I can’t build a full URL to be recognized.

Is there any recommended patterns for deep linking with unresolved params?

2 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 4870

Trending Articles