Ember.js Starter Kit (Pre4)
Based on latest version (as of today) of the official Ember.js starter kit: https://github.com/emberjs/starter-kit Links to latest full-size versions of Handlebars, Ember, and Ember-Data.
by mavilein
HTML
<script src="https://github.com/downloads/wycats/handlebars.js/handlebars-1.0.rc.1.js"></script>
<script src="https://raw.github.com/emberjs/ember.js/release-builds/ember-1.0.0-pre.4.js"></script>
<script type="text/x-handlebars" data-template-name="application">
<h1>Hello from Ember.js</h1>
<a href="#" {{action "applicationViewAction"}}> applicationViewAction! </a>
{{outlet namedOutlet}}
</script>
<script type="text/x-handlebars" data-template-name="myview">
<hr/>
This is myview template!
<a href="#" {{action "missingAction"}}> missingAction! </a>
</script>
JavaScript
var App = Ember.Application.create();
App.ApplicationController = Ember.Controller.extend({
applicationViewAction: function(event){
alert("foo");
}
});
App.ApplicationView = Ember.View.extend({
templateName: 'application',
applicationViewAction: function(event){
alert("foo");
}
});
// Router
App.Router.map(function() {
this.route("/");
});
App.IndexRoute = Ember.Route.extend({
renderTemplate: function(controller, model) {
this.render('myview', { // the template to render
into: 'application', // the template to render into
outlet: 'namedOutlet', // the name of the outlet in that template
// controller: this.controllerFor("foo") // the controller to use for the template
});
}
});
//App.initialize();