From 101c85b75b5a57fd8b503a84ab3393626a1c00c1 Mon Sep 17 00:00:00 2001 From: Will Raxworthy Date: Mon, 28 Mar 2016 13:40:16 -0700 Subject: [PATCH] add documentation for didinitattrs deprecation --- source/deprecations/v2.x.html.md | 33 ++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/source/deprecations/v2.x.html.md b/source/deprecations/v2.x.html.md index 54988896f9..9c0ce246a7 100644 --- a/source/deprecations/v2.x.html.md +++ b/source/deprecations/v2.x.html.md @@ -342,3 +342,36 @@ export default Ember.Component.extend({ }); )}; ``` + +#### Ember.Component#didInitAttrs + +Using `didInitAttrs` is deprecated in favour of using `init`. When `init` is called the attrs sent in with the component will be +available after calling `this._super(...arguments)` + +Given a htmlbars template like this: + +```hbs +{{my-component handle="@tomdale"}} +``` + +Before: + +```js +export default Ember.Component.extend({ + didInitAttrs() { + this._super(...arguments); + this.get('handle'); // @tomdale + } +}); +``` + +After: + +```js +export default Ember.Component.extend({ + init() { + this._super(...arguments); + this.get('handle'); // @tomdale + } +}); +```