1
votes

Posting here as requested original post can be found here Hello, I would like to build ember.js using Ubuntu 13. I have cloned the official Github project, cd into the project and as described in the readme file I did: bundle install rake dist no error is shown on screen and as a result I get a directory shown in the image enter image description here

I would like to use ember and ember-data, so I include ember.js ember-data-deps.js files in my test project. The problem is that I am getting a TypeError: App.Router is undefined I am using this at my client.js file to init ember

this.App = Ember.Application.create();

App.Router.map(function() { this.route('contributors'); this.route('contributor', {path: '/contributors/:contributor_id'}); });

Am I doing something wrong in the build process? Should I include some other js files in my project? Thank you in advanced.

1
it would also be useful to get see how your project is setupintuitivepixel

1 Answers

2
votes
  • The TypeError: App.Router is undefined error is because ember.js is not loaded correctly or in the correct order.

  • To get ember-data (that is separate from ember.js) you have to clone this repo (https://github.com/emberjs/data) and follow the build instructions in the readme file, it's straight forward, and once you have the dist directory from the ember-data build process get the file ember-data.js development version or ember-data.min.js for production (well, production... ember-data is still considered unstable for production environments).

here is a simple ember project setup using ember-data:

index.html

<!DOCTYPE HTML>
<html lang="en-US">
  <head>
    <meta charset="UTF-8">
    <title>ember app</title>
  </head>
  <body>

  <script type="text/x-handlebars">
    hello world!
  </script>

  <script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script>
  <script type="text/javascript" src="http://builds.emberjs.com.s3.amazonaws.com/handlebars-1.0.0-rc.3.js"></script>
  <script type="text/javascript" src="http://builds.emberjs.com.s3.amazonaws.com/ember-latest.js"></script>
  <script type="text/javascript" src="http://builds.emberjs.com.s3.amazonaws.com/ember-data-latest.js"></script>

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

  </body>
</html>

app.js

var App = Ember.Application.create({
  ready: function () {
    console.log("app started...");
  }
});

hope it helps