DS.Model#didDefineProperty()

didDefineProperty (proto, key, value)

Defined in addon/-private/system/relationships/ext.js:102

This Ember.js hook allows an object to be notified when a property is defined.

In this case, we use it to be notified when an Ember Data user defines a belongs-to relationship. In that case, we need to set up observers for each one, allowing us to track relationship changes and automatically reflect changes in the inverse has-many array.

This hook passes the class being set up, as well as the key and value being defined. So, for example, when the user does this:

DS.Model.extend({
  parent: DS.belongsTo('user')
});

This hook would be called with "parent" as the key and the computed property returned by DS.belongsTo as the value.

Parameters:

proto Object
key String
value Ember.ComputedProperty
doc_EmberJs
2016-11-30 16:50:07
Comments
Leave a Comment

Please login to continue.