Using two models in a single controller

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 =‘person’);
	var contacts =‘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.

You should do the find calls in the router and then set them as property on the controller. The router will wait until all promises are solved and then you dont have to worry about those.

And maybe you might wanna think of a relation between both Models, as the person seems to belong to a contact.