mercredi 1 février 2017

How does one initialize/use ember-data by itself (without ember-cli)?

I'm in a shop where we can't use ember-cli (this saddens me, but it is what it is), and we'd like to use ember-data along side our app. The documentation gets us started, but I can't seem to initialize the store correctly (I think).

Here's what we have:

<script src="../ember/ember.debug.js"></script>
<script src="../ember-data/ember-data.js"></script>
<script>
  (function(){
  'use strict';

  window.File = window.File || DS.Model.extend({
    id: DS.attr()
  });

  window.store = window.store || DS.Store.extend({
    'file': window.File});
  })();

  window.store.findRecrod('file', 1); // findRecord Doesn't exist
  })();
</script>

The classes get defined correctly, but the method findRecord doesn't exist. What am I doing wrong?

Am I initializing the store incorrectly, or do I need to register the Model a different way, or is it something else?

We'd like to use the default JSONAPI adapter, FWIW.




Aucun commentaire:

Enregistrer un commentaire