How to relate models to each other with aid from the ui?


#1

I’m trying to develop a simple CRM app just to learn ember. So far, i have Companies and People. I’ve established the relationship between the two like below.

App.Company = DS.Model.extend({

  name: DS.attr('string'),
  people: DS.hasMany('person')
});

App.Person = DS.Model.extend({

  firstName: DS.attr('string'),

  lastName: DS.attr('string'),

  company: DS.belongsTo('company'),

  fullName: function() {
    return this.get('firstName') + ' ' + this.get('lastName');
  }.property('firstName', 'lastName') 
});

I’m trying have some kind of html input in the Person edit template where I can choose which company the Person belongs to. I’ve yet to see an example of this which is very surprising.

How is this typically done? Is there a typeahead/autocomplete widget/component/view that helps with this i’m unaware of?