简体   繁体   中英

TypeError DS.RESTAdapter is undefined when include ember-data

I need your help. Indeed, I'm trying to include EmberJS and ember-data to SailsJS.

For Ember I do not have any problem, but when I include ember-data I've 2 errors in my JS console :

TypeError: Ember.State is undefined
TypeError: DS.RESTAdapter is undefined

I need RESTAdapter for calling my models through REST Sails API.

Here my begin of JS code for Ember :

var App = Ember.Application.create();
App.Users = DS.RESTAdapter.reopen({host: '/foo'});

My layout.ejs is correctly loaded and - i think - the librairies included in the correct order :

<script src="linker/js/socket.io.js"></script>
<script src="linker/js/sails.io.js"></script>
<script src="linker/js/app.js"></script>
<script src="linker/js/jquery-min.js"></script>
<script src="linker/js/handlebars.js"></script>
<script src="linker/js/ember-min.js"></script>
<script src="linker/js/ember-data-min.js"></script>

Thanks by advance for your help.

Cyril.

You have app.js included before Ember and Ember-Data. If your code is executing upon load, neither Ember nor Ember-Data are loaded at that point. Move app.js so it's loaded after all of it's dependencies.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM