Quantcast
Viewing all articles
Browse latest Browse all 4829

How to link to an element that has both a param and non-param route

@keanedawg wrote:

So in the Router I kinda have something that looks like us.

  this.route('contact', { path: '/contact/:product_id'});
  this.route('contact');

The way our website works is if a user clicks on the “Request a Sample” from a certain product’s page, that page will put the product’s id into the URL and then the contact form will autofill the product the user is requesting a sample for. I have it set up like this in my product’s page.

{{link-to 'contact' myProductID} class="btn btn-primary btn-lg"}`

The problem is that the productID is clearly not being passed. I suspect this is because “link-to” only uses the URL of the last this.route(‘contact’) defined. Therefore it assumes I don’t require any parameters. I could make the contact route require a product_id, but the problem is that there are several links which don’t use any parameters.

Is there a way for {{link-to}} to specify that I want to use this.route('contact', { path: '/contact/:product_id'}); instead of this.route('contact');?

Posts: 3

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 4829

Trending Articles