Skip to content

Commit

Permalink
[DOC] Add more guidance on using @each rather than []
Browse files Browse the repository at this point in the history
Updated docs in response to
#12360
  • Loading branch information
abepetrillo committed Mar 28, 2016
1 parent e35e8b4 commit f2b42ab
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions packages/ember-runtime/lib/mixins/array.js
Original file line number Diff line number Diff line change
Expand Up @@ -540,8 +540,23 @@ export default Mixin.create(Enumerable, {
return an enumerable that maps automatically to the named key on the
member objects.
If you merely want to watch for any items being added or removed to the array,
use the `[]` property instead of `@each`.
@each should only be used in a non-terminal context, and is deprecated when
used as a leaf node. Example:
```javascript
myMethod: computed('[email protected]', function(){
...
});
```
If you merely want to watch for the array being changed, like an object being
replaced, added or removed, use `[]` instead of `@each`.
```javascript
myMethod: computed('posts.[]', function(){
...
});
```
@property @each
@public
Expand Down

0 comments on commit f2b42ab

Please sign in to comment.