Observers for array type property in the model


#1

How to avoid data repetition in the array type property in an has many relationship model and the component used is ember-selectize.


#2

Computed property, we’ll call it selectable which filters out any duplicates between selected and content (your full array of contacts).


#3

Like sortProperties is there any such selectable properties available in controllers Or user defined function which will be triggered from array observer and filter the selected data from the content of the data binding to the consecutive dropdowns.


#4
selectable: Ember.computed('selected.length', 'content', function() {
  // this should be optimized, but you get the idea
  var selected = this.get('selected');
  return this.get('content').filter(function(obj) {
     return selected.indexOf(obj) === -1;
  });
});

Now bind selectable to your select component instead of content