Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update docs for the built-in components for routing/specifying-a-routes-model.md #699

Merged
merged 2 commits into from
Mar 31, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions guides/release/routing/specifying-a-routes-model.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,34 +85,34 @@ photo's ID (`params.photo_id`) as an argument to Ember Data's `findRecord`
method.

Note: A route with a dynamic segment will always have its `model` hook called when it is entered via the URL.
If the route is entered through a transition (e.g. when using the [link-to](../../templates/links/) Handlebars helper),
and a model context is provided (second argument to `link-to`), then the hook is not executed.
If the route is entered through a transition (e.g. when using the [`<LinkTo />`](../../templates/links/) component),
and a model object is provided, then the hook is not executed.
If an identifier (such as an id or slug) is provided instead then the model hook will be executed.

For example, transitioning to the `photo` route this way won't cause the `model` hook to be executed (because `link-to`
was passed a model/):
For example, transitioning to the `photo` route this way won't cause the `model` hook to be executed (because `<LinkTo />`
was passed a model):

```handlebars {data-filename=app/templates/photos.hbs}
<h1>Photos</h1>
{{#each this.model as |photo|}}
<p>
{{#link-to "photo" photo}}
<LinkTo @route="photo" @model={{photo}}>
<img src="{{photo.thumbnailUrl}}" alt="{{photo.title}}" />
{{/link-to}}
</LinkTo>
</p>
{{/each}}
```

while transitioning this way will cause the `model` hook to be executed (because `link-to` was passed `photo.id`, an
while transitioning this way will cause the `model` hook to be executed (because `<LinkTo />` was passed `photo.id`, an
identifier, instead):

```handlebars {data-filename=app/templates/photos.hbs}
<h1>Photos</h1>
{{#each this.model as |photo|}}
<p>
{{#link-to "photo" photo.id}}
<LinkTo @route="photo" @model={{photo.id}}>
<img src="{{photo.thumbnailUrl}}" alt="{{photo.title}}" />
{{/link-to}}
</LinkTo>
</p>
{{/each}}
```
Expand Down