How in the world can I get a handle to the repository inside a component? I am trying to create an autocomplete component that returns results from the repository.
App.AutoCompleteComponent = Ember.Component.extend({ //------------------------------------------- // Ember Properites //------------------------------------------- content: Ember.ArrayController.create(), //------------------------------------------- // Instance Properties //------------------------------------------- queryText: "", componentItemSelected: null, //------------------------------------------- // Observers //------------------------------------------- queryTextChanged: function () { this.updateContent(this.get("queryText")); }.observes("queryText"), //------------------------------------------- // Instance Methods //------------------------------------------- selectItem: function (item) { this.set("componentItemSelected", item); }, updateContent: function (queryText) { if (queryText.length <= 5) { console.log('not greater than 5 chars'); return; } this.get("content").setObjects([]); var items = App.Company.find(); this.get("content").setObjects(items); } });
here is my company model
App.Company = DS.Model.extend({ name: DS.attr('string'), created_at: DS.attr('date'), updated_at: DS.attr('date'), people: DS.hasMany('person') });
I tried:
this.get('store')DS.Store.find('company')- just
store App.Company.find()
I always get Uncaught TypeError ... has no method 'find'
David
source share