I’m relatively new to JS and definitely new to Ember. In my small application I have two models: person { id, name }, contact { id, name, address, phone, … }. I’m trying to go over both models and find all matches, based on the name and display a list of duplicates based on the Contact, since it contains more information.
I’ve tried using a computed property:
App.DuplicatesController = Ember.Controller.extend({
duplicatePeople: function() {
var people = this.store.find(‘person’);
var contacts = this.store.find(‘contact’).then(function(result) {
return result.sortBy(‘name’);
});
Ember.RSVP.Promise.all( [people, contacts] ).then(function(result) {
return Ember.EnumerableUtils.intersection(people, contacts);
});
}.property(‘person’, ‘contact’) });
However, it doesn’t work.
I’m not completely sure that this should be done on the client side vs server side, but still, I would like to know how would I go about solving this issue. I’m suspecting I may be accessing the models wrong.
Any hint is appreciated.