CoreObject.metaForProperty()

metaForProperty (key) privatestatic

Defined in packages/ember-runtime/lib/system/core_object.js:792

In some cases, you may want to annotate computed properties with additional metadata about how they function or what values they operate on. For example, computed property functions may close over variables that are then no longer available for introspection.

You can pass a hash of these values to a computed property like this:

person: function() {
  var personId = this.get('personId');
  return App.Person.create({ id: personId });
}.property().meta({ type: App.Person })

Once you've done this, you can retrieve the values saved to the computed property from your class like this:

MyClass.metaForProperty('person');

This will return the original hash that was passed to meta().

Parameters:

key String
property name
doc_EmberJs
2016-11-30 16:49:03
Comments
Leave a Comment

Please login to continue.