Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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>
like image 541
Niko Efimov Avatar asked Feb 01 '13 03:02

Niko Efimov


2 Answers

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

like image 175
Gustavo Hoirisch Avatar answered Oct 21 '22 13:10

Gustavo Hoirisch


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.

like image 45
Karl Brightman Avatar answered Oct 21 '22 14:10

Karl Brightman