Skip to content

Convert routing section to route components #2118

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

Open
wants to merge 3 commits into
base: gjs
Choose a base branch
from
Open

Convert routing section to route components #2118

wants to merge 3 commits into from

Conversation

locks
Copy link
Contributor

@locks locks commented Jun 2, 2025

No description provided.

Copy link

netlify bot commented Jun 2, 2025

Deploy Preview for ember-guides ready!

Name Link
🔨 Latest commit 9517054
🔍 Latest deploy log https://app.netlify.com/projects/ember-guides/deploys/685eccfe66000400088ab795
😎 Deploy Preview https://deploy-preview-2118--ember-guides.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

<h1>Posts</h1>
{{!-- Display posts and other content --}}
{{outlet}}
```handlebars {data-filename=templates/posts.gjs}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still in draft I see, but just quickly noticed this should be gjs instead of handlebars for all code blocks.

@locks locks changed the base branch from master to gjs June 20, 2025 15:32
@mansona mansona marked this pull request as ready for review June 27, 2025 16:55
Copy link
Contributor

@kategengler kategengler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There were a few missed spots.

I also think there needs to be a general introduction / explanation that route templates are components (cross-linking to component docs) with special arguments @model and @controller (see https://rfcs.emberjs.com/id/1046-template-tag-in-routes).

I think we should say 'route component' instead of 'template'.

@@ -65,7 +65,7 @@ Router.map(function() {
```

The route defined above will by default use the `blog-post.js` route handler,
the `blog-post.hbs` template, and be referred to as `blog-post` in any
the `blog-post.gjs` template, and be referred to as `blog-post` in any
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Above here (I cannot comment on unedited lines) are references to template and examples of hbs that need to be converted.

@@ -109,17 +109,22 @@ ember generate route posts/new
And then add the `{{outlet}}` helper to your template where you want the nested
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we be saying 'route component' rather than 'template'?

@@ -16,5 +16,5 @@ the `posts.new` route will render `posts/new.hbs`.

Each template will be rendered into the `{{outlet}}` of its parent route's
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Text above here references hbs

@@ -216,25 +234,33 @@ instead.
When you provide a string or number to the `<LinkTo>`, the dynamic segment's `model` hook will run when the app transitions to the new route.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

References above here to hbs

link text to display
</LinkTo>
{{/each}}
</template>
```

If you decide to pass the entire model, be sure to cover this behavior in your [application tests](../../testing/testing-application/).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

handlebars below here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants