Skip to content
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
40 changes: 40 additions & 0 deletions content/ember/v3/partial.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
id: ember.partial
title: Deprecate `{{partial}}`
until: '4.0.0'
since: '3.15'
---

We are deprecating usage of `{{partial}}` in accordance with [RFC #449](https://github.com/emberjs/rfcs/blob/master/text/0449-deprecate-partials.md).

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

```hbs
{{! app/templates/application.hbs }}
{{#let (hash title="Don't use partials" body="Components are always better") as |tip|}}
{{partial "partials/quick-tip"}}
{{/let}}
```

```hbs
{{! 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:

```hbs
{{! 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}}
```

```hbs
{{! app/templates/components/quick-tip.hbs }}
<h1>Tip: {{@tip.title}}</h1>
<p>{{@tip.body}}</p>
<button {{action @onDismiss}}>OK</button>
```