<LinkTo>

Renders an anchor that navigates to a route without a full page reload.

Since Ember 4/5 (Octane) Spec ↗

Syntax

<LinkTo @route="name" @model={{model}}>text</LinkTo>

Returns

element — An <a> element wired to the router.

Examples

<nav>
  <LinkTo @route="index">Home</LinkTo>
  <LinkTo
    @route="post"
    @model={{this.post}}
    class="nav-link"
    activeClass="is-active"
  >
    {{this.post.title}}
  </LinkTo>
</nav>
<LinkTo @route="search" @query={{hash q="ember"}}>Search</LinkTo>

Notes

Use the angle-bracket <LinkTo> component (the {{link-to}} helper is legacy). Pass @model or @models for dynamic segments and @query for query params. It applies an active class automatically.