Skip to content

Instantly share code, notes, and snippets.

@avaz
Created December 18, 2015 15:58
Show Gist options
  • Save avaz/d8094d94a9d2db65f18e to your computer and use it in GitHub Desktop.
Save avaz/d8094d94a9d2db65f18e to your computer and use it in GitHub Desktop.
ContextualComponentsTriggerAction
{{#if hasBlock}}
{{yield}}
{{else}}
X
{{/if}}
import Ember from 'ember';
export default Ember.Component.extend({
actions: {
close: function() {
alert('close');
}
}
});
<div class="alert-box">
{{yield (hash
close-button=(component 'alert-box-button' onclick=(action 'close'))
)}}
</div>
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle'
});
<h1>Welcome to {{appName}}</h1>
<br>
<br>
{{#alert-box as |box|}}
One Form
{{#box.close-button}}
Hit here to close!
{{/box.close-button}}
{{/alert-box}}
{{outlet}}
<br>
<br>
{
"version": "0.4.17",
"EmberENV": {
"FEATURES": {}
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js",
"ember": "beta",
"ember-data": "https://cdnjs.cloudflare.com/ajax/libs/ember-data.js/2.2.0/ember-data.js",
"ember-template-compiler": "beta"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment