How in the world do i get a handle on the store inside of a component? I'm trying to create an auto-complete component that returns results from the store.
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've tried:
this.get('store')
DS.Store.find('company')
- just
store
App.Company.find()
I always get an Uncaught TypeError ... has no method 'find'