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

Artem Syromiatnikov
Artem Syromiatnikov
4,706 Points

The Ember Workflow clarification

"Convention over configuration" approach does a good job of hiding framework details from the developer. However, I'd like to know these details - for now there is too much magic and not enough logic for me :) I'm trying to understand Ember workflow in detail. Here is what I see, correct me if I'm wrong.

  1. Browser requests a url. Let's say its "http://whatever.com/#/posts"
  2. Ember analyses the part after has sigh - it is 'posts'
  3. Ember refers to our Router (defined in Blogger.Router.map()...) to find what resource corresponds to the path. By default (this.resource('posts')) it is 'posts'.
  4. Ember looks for Route called PostsRoute. It it is found, it defines following data:
    • what should be rendered (this.render('posts') means that template 'posts.hbs' must be rendered)
    • what data should be passed to aforementioned template (model: function() { return posts; })
    • and what Controller should handle users input (controller: 'posts' means that our desired controller is PostsController)