Ember Latest
The latest build of Ember.
HTML
<script src="http://builds.emberjs.com/handlebars-1.0.0.js"></script>
<script src="http://builds.emberjs.com/ember-latest.js"></script>
<script type="text/x-handlebars" data-template-name="index">
{{#foo-bar action='foo'}}
<p>
<h2>Nested component</h2>
{{foo-bar action='foo'}}
</p>
{{/foo-bar}}
</script>
CSS
h1 { font-size: 1.6em; padding-bottom: 10px; }
h2 { font-size: 1.4em; }
ul { padding: 15px; font-size: 1.4em; color: green; }
JavaScript
App = Ember.Application.create({});
App.IndexController = Ember.Controller.extend({
actions: {
foo: function() { alert('controller foo'); }
}
});
App.FooBarComponent = Ember.Component.extend({
layout: Ember.Handlebars.compile('<button {{action \'foo\'}}>Trigger</button>{{yield}}'),
actions: {
foo: function() {
alert('component foo');
this.sendAction();
}
}
});