2

I am new with ember.js and trying to understand ember but existing example "Building an App with Ember.js" is not working and I am facing some TypeError like TypeError: Application.registerInjection is not a function, I included scripts

<script src="js/libs/jquery-1.9.1.js"></script>
<script src="js/libs/handlebars-1.0.0-rc.3.js"></script>
<script src="js/libs/ember-1.0.0-rc.3.js"></script>
<script src="js/libs/ember-data-latest.js"></script>

I did not understand how to solve it, can anybody help me?

my app.js code is

App = Ember.Application.create();

App.Store = DS.Store.extend({
revision: 12,
adapter: 'DS.FixtureAdapter'
});

App.Router.map(function() {
  this.resource('posts');
  this.resource('about');
});

App.PostRoute = Ember.Route.extend({
model: function() {
    return App.Post.find();
}
});

App.Post = DS.Model.extend({
title: DS.attr('string'),
author: DS.attr('string'),
intro: DS.attr('string')    
});

App.Post.FIXTURES = [{
id: 1,
title: "Ember leaning",
author: "Anand",
intro: "Write dramatically less code with Ember's Handlebars integrate templates    that update automatically when the underlying data changes."
}, {
id: 2,
title: "A framework for creating ambitious web application",
intro: "Don't waste time making trivial choices. Ember.js incorporates common idioms so you can focus on what makes your app special, not reinventing the wheel."
}];

my index.html code is

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Ember Starter Kit</title>
   <link rel="stylesheet" href="css/normalize.css">
   <link rel="stylesheet" href="css/bootstrap.min.css">
   <link rel="stylesheet" href="css/style.css">
</head>
<body>

 <script type="text/x-handlebars">
 <div class="navbar">
  <div class="navbar-inner">
    <a class="brand" href="#">Bloggr</a>
      <ul class="nav">
        <li>{{#linkTo 'posts'}}Posts{{/linkTo}}</li>
        <li>{{#linkTo 'about'}}About{{/linkTo}}</li>
      </ul>
  </div>
 </div>

{{outlet}}    
 </script>

 <script type="text/x-handlebars" id="posts">
 <div class="container-fluid">
  <div class="row-fluid">
    <div class="span3">
      <table class="table">
        <thead>
          <tr>
            <th>Recent Post</th>
          </tr>
        </thead>
        {{#each model}}
        <tr>
          <td>
            <a href="#">{{title}}<small class="muted"> by {{Author}}</small></a>
          </td>
        </tr>
        {{/each}}
      </table>
    </div>
    <div class="span9">
    </div>
  </div>      
 </div>
 </script>

 <script type="text/x-handlebars" id="about">
 <div class='about span12 hero-unit'>
   <p>IDEX Solution&#8217;s aims to provide solutions for Linux Platform, located in Gandhidham, Gujarat. Here at IDEX,  we provide services to small / medium businesses and home users who want to enjoy the power of Linux.
  </p>
  <p>Whilst as a company, we were formed in Jan 2004, Company&#8217;s founder is working on Linux since 1995. We use Linux in everyday of our lives on our Laptops, Desktops and Servers.
  </p>
  <p>We specialize in providing Tailor Made Software Solutions for our clients in very affordable prices. Since we use all Open Source Software, which help us to keep our prices very low, so our clients can enjoy this benefit. Visit our <a href="http://idexindia.com/products">Products</a> page for more information on our existing products, we also provide other services as well, kindly visit our <a href="http://idexindia.com/services">Services</a> page for more information.
  </p>
</div>
</script>

<script src="js/libs/jquery-1.9.1.js"></script>
<script src="js/libs/handlebars-1.0.0-rc.3.js"></script>
<script src="js/libs/ember-1.0.0-rc.3.js"></script>
<script src="js/libs/ember-data-latest.js"></script>
<script src="js/app.js"></script>

</body>
</html>
5
  • Have you started writing anything on your own? Commented Apr 24, 2013 at 6:46
  • yes i started with ember example Commented Apr 24, 2013 at 6:49
  • Could you post that code, please? Commented Apr 24, 2013 at 6:49
  • you can see my .js code Commented Apr 24, 2013 at 6:50
  • can any help me to solve this type of problem? Commented Apr 24, 2013 at 8:16

1 Answer 1

5

First of all, you should notice from the error message in your console that the problem is inside "ember-data-latest.js". You don't need to post all of your application code. Second, ember-data-latest.js as found on GitHub is not up to date with the latest changes to ember. You can find a version of ember-data that should work here:

http://builds.emberjs.com.s3.amazonaws.com/ember-data-latest.js

Sign up to request clarification or add additional context in comments.

3 Comments

This was exactly what I was after, as I had a similar issue.
Yup, fixed it for me too
That S3 link is now dead -- is there an official CDN mirror?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.