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({ ...@@ -15,25 +15,26 @@ require.config({
define( 'app', [ define( 'app', [
'app/router', 'app/router',
'app/models/store', 'app/models/store',
'app/controllers/todos', 'app/controllers/entries',
'jquery', 'jquery',
'ember', 'ember'
], function( Router, Store, TodosController ) { ], function( Router, Store, EntriesController ) {
var App = Ember.Application.create({ var App = Ember.Application.create({
VERSION: '0.2', VERSION: '0.2',
rootElement: '#main',
init: function() { // Load routes
this._super(); Router: Router,
// Extend to inherit outlet support
this.set( 'todosController', TodosController.create( ApplicationController: Ember.Controller.extend(),
ApplicationView: Em.View.extend({
template: Ember.Handlebars.compile( '{{outlet}}' )
}),
// Preload entries controller
entriesController: EntriesController.create(
{ store: new Store( 'todos-emberjs' ) } { store: new Store( 'todos-emberjs' ) }
) ); )
}
}); });
// Initialize Application to load routes
App.Router = Router;
App.initialize(); App.initialize();
// Expose the application globally // Expose the application globally
return window.Todos = App; 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