Getting Started: Understanding hidden boilerplate


#1

I’m just starting out with Ember. I think one of the hard things to grasp initially is what’s happening behind the scenes. If I don’t provide a series of standard MVC Ember objects, it creates them for me in memory, providing default behavior. That’s great, but as a beginner it’s more magic than I want while getting started.

Rails was relatively easy to get started with in the beginning because scaffolding gave me all of this boilerplate to look at, which gave me some initial sense of what I was working with and how to override the default behavior.

I wonder if anyone can help give me a sense of what the “scaffolding” is for the most simple Ember “hello, world” example. What objects are getting created for me here?

In my html file:

<script src='text/x-handlebars'>
  <h1>Hello, Ember!</h1>
</script>

In my JavaScript file:

var App = Ember.Application.create();

#2

I think your can get what you want from this screencast http://toranbillups.com/blog/archive/2013/03/02/emberjs-rc1-introduction-screencast/.


#3

Thank you, Towerhe. That screencast was perfect. To recap, the hello world example from above could be done more explicitly with the following:

In my HTML file:

<script type='text/x-handlebars' data-template-name='application'>
    <h1>Hello, Ember!</h1>
</script>

In my JavaScript file:

var App = Ember.Application.create();
App.ApplicationController = Ember.Controller.extend();
App.ApplicationView = Ember.View.extend(function(){
    templateName: 'application'
});
App.Router.map(function(){
});