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

Computed Properties

Computed Properties What are Computed Properties? In a nutshell, computed properties let you declare functions as properties. You create one by defining a computed property as a function, which Ember will automatically call when you ask for the property. You can then use it the same way you would any normal, static property. It's super handy for taking one or more normal properties and transforming or manipulating their data to create a new value. Computed properties in action We'll start wit

ComputedProperty

Ember.ComputedProperty Class PUBLIC Defined in: packages/ember-metal/lib/computed.js:30 Module: ember-metal A computed property transforms an object literal with object's accessor function(s) into a property. By default the function backing the computed property will only be called once and the result will be cached. You can specify various properties that your computed property depends on. This will force the cached result to be recomputed if the dependencies are modified. In the followin

Computed Properties and Aggregate Data

Computed Properties and Aggregate Data Sometimes you have a computed property whose value depends on the properties of items in an array. For example, you may have an array of todo items, and want to calculate the incomplete todo's based on their isDone property. To facilitate this, Ember provides the @each key illustrated below: app/components/todo-list.js export default Ember.Component.extend({ todos: null, init() { this.set('todos', [ Ember.Object.create({ isDone: true }),

Component.positionalParams

positionalParamspublicstatic Defined in packages/ember-htmlbars/lib/component.js:299 Available since 1.13.0 Enables components to take a list of parameters as arguments. For example, a component that takes two parameters with the names name and age: let MyComponent = Ember.Component.extend; MyComponent.reopenClass({ positionalParams: ['name', 'age'] }); It can then be invoked like this: {{my-component "John" 38}} The parameters can be referred to just like named parameters: Name: {{attr

Component#willUpdate event

willUpdatepublic Defined in packages/ember-htmlbars/lib/component.js:442 Available since 1.13.0 Called when the component is about to update and rerender itself. Called only during a rerender, not during an initial render.

Component#willRender()

willRenderpublic Defined in packages/ember-htmlbars/lib/component.js:394 Available since 1.13.0 Called before a component has been rendered, both on initial render and in subsequent rerenders.

Component#willRender event

willRenderpublic Defined in packages/ember-htmlbars/lib/component.js:404 Available since 1.13.0 Called before a component has been rendered, both on initial render and in subsequent rerenders.

Component#willUpdate()

willUpdatepublic Defined in packages/ember-htmlbars/lib/component.js:432 Available since 1.13.0 Called when the component is about to update and rerender itself. Called only during a rerender, not during an initial render.

Component#hasBlockParams

hasBlockParamspublic Defined in packages/ember-htmlbars/lib/component.js:258 Available since 1.13.0 Returns true when the component was invoked with a block parameter supplied. Example (hasBlockParams will be false): {{! templates/application.hbs }} {{#foo-bar}} No block parameter. {{/foo-bar}} {{! templates/components/foo-bar.hbs }} {{#if hasBlockParams}} This will not be printed, because no block was provided {{yield this}} {{/if}} Example (hasBlockParams will be true): {{! templ