Ember.computed.uniq()

uniq (propertyKey) Ember.ComputedPropertypublic

Defined in packages/ember-runtime/lib/computed/reduce_computed_macros.js:330

A computed property which returns a new array with all the unique elements from one or more dependent arrays.

Example

let Hamster = Ember.Object.extend({
  uniqueFruits: Ember.computed.uniq('fruits')
});

let hamster = Hamster.create({
  fruits: [
    'banana',
    'grape',
    'kale',
    'banana'
  ]
});

hamster.get('uniqueFruits'); // ['banana', 'grape', 'kale']

Parameters:

propertyKey String

Returns:

Ember.ComputedProperty
computes a new array with all the unique elements from the dependent array
doc_EmberJs
2016-11-30 16:51:21
Comments
Leave a Comment

Please login to continue.