Incomplete `Transition.to` passed to `routeWillChange` when using `{{#link-to}}` with a model
- Dominant language
- TypeScript
- Stars
- 22.6k
- Forks
- 4.2k
- Avg merge
- 3d 12h
- Merged PRs (30d)
- 15
Description
Given the following route definition:
**router.js**
```javascript
Router.map(function() {
this.route('foo', { path: 'foo/:id' });
});
```
The following application controller:
**application/controller.js**
```javascript
import Controller from '@ember/controller';
import { inject } from '@ember/service';
const SOME_MODEL = { id: 123 };
export default Controller.extend({
someModel: SOME_MODEL,
router: inject(),
init(...args) {
this._super(...args);
this.router.one('routeWillChange', ({ to }) => {
console.log(to.params);
});
}
});
```
And the following application template:
**application/template.hbs**
```handlebars
{{#link-to "foo" 123}}Click me{{/link-to}}
{{#link-to "foo" someModel}}Click me{{/link-to}}
{{outlet}}
```
Clicking the first link takes me to `http://localhost:4200/foo/123` and produces the following output in the console:
```
{id: "123"}
```
which is correct. Clicking the second link also takes me to `http://localhost:4200/foo/123`, however it produces the following output in the console:
```
{}
```
I was expecting these two `{{#link-to}}` to both produce the same console output.
Contributor guide
Assessment
This issue has not been assessed yet.