« All deprecation guides

Deprecation Guide for {{partial}}

until: 4.0.0
id: ember.partial

We are deprecating usage of {{partial}} in accordance with RFC #449.

Partials should be migrated to components. For example, consider the following quick-tip partial:

app/templates/application.hbs
{{#let (hash title="Don't use partials" body="Components are always better") as |tip|}}
  {{partial "partials/quick-tip"}}
{{/let}}
app/templates/partials/quick-tip.hbs
<h1>Tip: {{tip.title}}</h1>
<p>{{tip.body}}</p>
<button {{on "click" this.dismissTip}}>OK</button>

It can be converted to a component as follows:

app/templates/application.hbs
{{#let (hash title="Don't use partials" body="Components are always better") as |tip|}}
  <QuickTip @tip={{tip}} @onDismiss={{this.dismissTip}} />
{{/let}}
app/templates/components/quick-tip.hbs
<h1>Tip: {{@tip.title}}</h1>
<p>{{@tip.body}}</p>
<button {{action @onDismiss}}>OK</button>