Skip to content

Instantly share code, notes, and snippets.

@AmilKey
Created February 29, 2016 10:46
Show Gist options
  • Select an option

  • Save AmilKey/cc68a8d105bce2a402d7 to your computer and use it in GitHub Desktop.

Select an option

Save AmilKey/cc68a8d105bce2a402d7 to your computer and use it in GitHub Desktop.
Ember.js 2.3 implement @each.property observer
The problem is that steps.[].stepStatus is not a valid dependent key anymore. You should replace it by steps.@each.stepStatus.
Here is a summary of valid and invalid dependent keys in current Ember versions:
array - this observes if the array reference itself changes, e.g replacing the entire array with another value or array such as that oldValue !== newValue.
array.[] - this observes both when the array itself changes (above) and when the array length changes (functionally equivalent of array.length)
array.@each.property - observes both cases above and when property of some of the array's items change
array.@each.{prop,anotherProp} - you can also observe multiple properties while specifying only one key. This expands to array.@each.prop and array.@each.anotherProp.
array.@each - isn't valid anymore, no trailing @each. Use .[] instead.
array.@each.property.property - Also not valid. Note that @each only works one level deep. You cannot use nested forms like todos.@each.owner.name or todos.@each.owner.@each.name.
array.[].property - not valid anymore. Use @each form instead.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment