ComputedProperty#meta()

meta (meta) public

Defined in packages/ember-metal/lib/computed.js:270

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: Ember.computed(function() {
  let personId = this.get('personId');
  return App.Person.create({ id: personId });
}).meta({ type: App.Person })

The hash that you pass to the meta() function will be saved on the computed property descriptor under the _meta key. Ember runtime exposes a public API for retrieving these values from classes, via the metaForProperty() function.

Parameters:

meta Object
doc_EmberJs
2016-11-30 16:48:50
Comments
Leave a Comment

Please login to continue.