Commit 43d57107 authored by Stas SUȘCOV's avatar Stas SUȘCOV

Update application initialization to make use of `ApplicationController` and `ApplicationView`.

Initialize entries controller upon application creation, to be passed later as content property.
parent 42e46b5d
......@@ -15,25 +15,26 @@ require.config({
define( 'app', [
'app/router',
'app/models/store',
'app/controllers/todos',
'app/controllers/entries',
'jquery',
'ember',
], function( Router, Store, TodosController ) {
'ember'
], function( Router, Store, EntriesController ) {
var App = Ember.Application.create({
VERSION: '0.2',
init: function() {
this._super();
this.set( 'todosController', TodosController.create(
{ store: new Store( 'todos-emberjs' ) }
) );
}
rootElement: '#main',
// Load routes
Router: Router,
// Extend to inherit outlet support
ApplicationController: Ember.Controller.extend(),
ApplicationView: Em.View.extend({
template: Ember.Handlebars.compile( '{{outlet}}' )
}),
// Preload entries controller
entriesController: EntriesController.create(
{ store: new Store( 'todos-emberjs' ) }
)
});
// Initialize Application to load routes
App.Router = Router;
App.initialize();
// Expose the application globally
return window.Todos = App;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment