Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript Ember.js Models Loading Arrays of JavaScript objects

jadaml
jadaml
11,593 Points

Posts view not showing. Model and routes files look ok though?

I've triple checked my code and I can't see the error I'm making that's not allowing the 'Posts' template to be rendered in the browser. All my other template render just fine.

I'm getting the error:

Error while processing route: posts posts is not defined ReferenceError: posts is not defined

My route file:

  model: function() {
    return posts;
  }
});

View:

  <h1>Dracula's Blog</h1>

  <ul>
    {{#each}}
      <li>{{title}}</li>
    {{/each}}
  </ul>

Index calling the store.js file with the posts, my router, and 'posts' in the template loader:

...
 <script src="blogger.js"></script>
  <script src="router.js"></script>
  <script scr="store.js"></script>

  <script src="controllers/about.js"></script>
  <script src="controllers/contact.js"></script>

  <script src="routes/posts.js"></script>

  <script>
    EmberHandlebarsLoader.loadTemplates([ 
      'posts', 'about', 'contact', 'phone', 'email', 'application'
    ]);
  </script>
</head>
...

1 Answer

jadaml
jadaml
11,593 Points

It was a syntax error calling a script with scr rather than src