title: Ember.JS create record in component and add to local Datastore, or best practice solution
body: <p><strong> Current situation: </strong>  I am trying to find a way to create a record of a specific model from within the "didInsertElement" method of a component, and add said data to the data store. </p>
  
  <p><strong> Reason for current situation: </strong> I am attaching event listeners to a button in my component HBS file. One of the buttons will trigger two cascaded but light ajax calls. The response from the last of these ajax calls will determine if I should create records or not. </p>
  
  <p><strong> Problem I am having: </strong> When I try to access the store like this from the component:</p>
  
  <pre><code>var myStore = this.store
  </code></pre>
  
  <p>I am getting an undefined object. For those of you asking, I have already added the following line to my component:</p>
  
  <pre><code>store: Ember.inject.service()
  </code></pre>
  
  <p>And I already have Ember-Data installed.</p>
  
  <p><strong> Solutions: </strong> I have found from a lot of research that interaction with the store is best done through the main route. But how would I attach event listeners to a component's jquery widget from a route? </p>
  
  <p>Are there any solutions that wouldn't require me to move all all the event listener code from the component to the route and thereby undo the modularity that ember is supposed to offer?</p>