Skip to content

Instantly share code, notes, and snippets.

@onechiporenko
Created April 8, 2016 12:19
Show Gist options
  • Save onechiporenko/82b6c9fa00c4fe524805420394118aa6 to your computer and use it in GitHub Desktop.
Save onechiporenko/82b6c9fa00c4fe524805420394118aa6 to your computer and use it in GitHub Desktop.
Block Parameters
import Ember from 'ember';
export default Ember.Component.extend({
a: 'component'
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Block Parameters',
emberVersion: Ember.VERSION,
a: 'application'
});
body {
margin: 12px 16px;
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-size: 12pt;
}
td {
vertical-align: top;
min-width: 300px;
}
<h1>{{appName}}</h1>
<h4>Ember {{emberVersion}}</h4>
{{outlet}}
<table>
<thead>
<tr>
<th><code>\{{my-comp1}}</code></th>
<th><code>\{{my-comp1 a=a}}</code></th>
<th><code>\{{#my-comp1}}</code></th>
<th><code>\{{#my-comp1 a=a}}</code></th>
<th><code>\{{#my-comp1 a as |a|}}</code></th>
<th><code>\{{#my-comp1 a=a as |a|}}</code></th>
</tr>
</thead>
<tbody>
<tr>
<td>{{my-comp1}}</td>
<td>{{my-comp1 a=a}}</td>
<td>
{{#my-comp1}}
<p>#BLOCK `a`: {{a}}</p>
<p>#BLOCK `this.a`: {{this.a}}</p>
{{/my-comp1}}
</td>
<td>
{{#my-comp1 a=a}}
<p>#BLOCK `a`: {{a}}</p>
<p>#BLOCK `this.a`: {{this.a}}</p>
{{/my-comp1}}
</td>
<td>
{{#my-comp1 a as |a|}}
<p>#BLOCK `a`: {{a}}</p>
<p>#BLOCK `this.a`: {{this.a}}</p>
{{/my-comp1}}
</td>
<td>
{{#my-comp1 a=a as |a|}}
<p>#BLOCK `a`: {{a}}</p>
<p>#BLOCK `this.a`: {{this.a}}</p>
{{/my-comp1}}
</td>
</tr>
</tbody>
</table>
<p>#COMPONENT `a`: {{a}}</p>
<p>#COMPONENT `this.a`: {{this.a}}</p>
{{#if hasBlock}}
<p><strong>#YIELD:</strong></p>
{{yield}}
{{/if}}
{
"version": "0.7.2",
"EmberENV": {
"FEATURES": {}
},
"options": {
"use_pods": false,
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js",
"ember": "2.4.4",
"ember-data": "https://cdnjs.cloudflare.com/ajax/libs/ember-data.js/2.4.3/ember-data.js",
"ember-template-compiler": "2.4.4"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment