Niko Efimov
Niko Efimov

Reputation: 2213

Ember: DS Not Defined

Just started learning Ember, following a few examples, and the very basic stuff fails on me.

I'm getting Uncaught ReferenceError: DS is not defined in Chrome.

I'm including Handlebars just before Ember.js

HTML

<html>
  <head>
    <title>Ember Test App</title>
    <link rel="stylesheet" type="text/css" href="css/bootstrap.min.css" />
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
    <script type="text/javascript" src="js/handlebars.js"></script>
    <script type="text/javascript" src="js/ember.js"></script>

  </head>
  <body>
    <div class="container">
      <div class="row">
        <div class="span8 offset2" id="app">
        </div>
      </div>
    </div>

  <script type="text/x-handlebars" data-template-name="application">
    <h1>Ember App</h1>
    {{outlet}}
  </script>

  <script type="text/javascript" src="app.js"></script>
  </body>
</html>

App.js

window.App = Ember.Application.create({
  rootElement: $("#app")
});

App.Store = DS.Store.extend({
  revision: 11
});

Solved - TIP:

Ensure that ember-data is included after ember itself:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
<script type="text/javascript" src="js/handlebars.js"></script>
<script type="text/javascript" src="js/ember.js"></script>
<script type="text/javascript" src="js/ember-data.js"></script>

Upvotes: 15

Views: 11944

Answers (2)

Gustavo Hoirisch
Gustavo Hoirisch

Reputation: 1657

You need ember-data to use DS.Store. I have uploaded it here for one of my jsFiddles to work cause I couldnt find it anywhere else.

Note however that you do not need ember-data to use ember.

EDIT:

Had to delete the one I had uploaded so just get it from http://github.com/emberjs/data/downloads

Upvotes: 21

Karl Brightman
Karl Brightman

Reputation: 11

You can grab ember-data by cloning the ember-data repo and running rake dist within the repo folder. This will push out the relevant release files under the dist folder.

Upvotes: 1

Related Questions