Nested Route - Too many dynamic segments?

I have this in my code:

{{#link-to 'contracts.contract.info' model.id (query-params modalRedirectUrl=modalRedirectUrl) title="View More" class="plus"}}
        {{fa-icon "plus" class="small"}}
{{/link-to}}

The router.js renders it like this:

this.route('contracts', function() {
    this.route('contract', { path: '/:contract_id' }, function() {
      this.route('info');
    });
});

I have something similar with this route:

{{#link-to 'lost.contract.schedule' model.id (query-params modalRedirectUrl=modalRedirectUrl appendedQueryParams=appendedQueryParams) class='btn btn-default'}}
  {{fa-icon 'calendar'}} Schedule An Appointment
{{/link-to}}

In my router.js file:

this.route('lost.contract', { path: '/lost/contract/view/:contract_id'}, function() {
  this.route('history');
  this.route('schedule');
});

However, I keep getting this error:

Uncaught Error: More context objects were passed than there are dynamic segments for the route: lost.contract.schedule

And I have no idea why when it works fine with the other one… does anybody have any idea why this won’t work?? I’m passing the id… that’s the only “dynamic segment”… I’m not passing anymore than that…

Thank you!

Your use of lost.contract is probably the issue. Does changing it to lost_contract work?

@acorncom no… it then says ‘there is no route lost.contract defined’

I have this in my router.js file:

this.route('service.contract', { path: '/service/contract/:contract_id' }, function() {
    this.route('schedule');
    this.route('history');
  });

and that one works just fine.

You would need to make the change from lost.contract to lost_contract in both the router and also anywhere you use the {{#link-to}} helper. If you’ve got it working other places than that may not be your issue. But in the interests of protecting yourself, I’d suggest switching away from using the dot notation for individual route names, it generally means something different :wink: