DMXzone Summer Sale: Save up to 51% with code DMXSUMMER26. Ends in

Getting Into Ember.js: Part 3

Accessing and managing data within Ember

Rey Bango hopes that you’re starting to see that Ember.js is a powerful, yet opinionated, framework. We’ve only scratched its surface; there’s more to learn before we can build something truly useful! We’ll continue using the Ember Starter Kit. In this portion of the series, we’ll review accessing and managing data within Ember.

 

In the last article, we worked with a static set of color names that were defined within a controller:

App.IndexRoute = Ember.Route.extend({
 setupController: function(controller) {
   controller.set('content', ['red', 'yellow', 'blue']);
 }
});

This allowed the controller to expose the data to the index template. That’s cute for a demo, but in real life, our data source will not be a hard-coded array.

This is where models comes in. Models are object representations of the data your application uses. It could be a simple array or data dynamically retrieved from a RESTful JSON API.

Comments

Be the first to write a comment

You must me logged in to write a comment.