Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Named Positional Parameters
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle',
currentBooleanValue: true,
actions: {
toggleIf() {
this.toggleProperty('currentBooleanValue');
return false;
}
}
});
<h1>Welcome to {{appName}}</h1>
<br>
<br>
{{outlet}}
{{#my-if currentBooleanValue}}
This is true
{{ else }}
This is false
{{/my-if}}
<button {{action 'toggleIf'}}>
Toggle if
</button>
<br>
<br>
import Ember from 'ember';
const { computed } = Ember;
const MyIfComponent = Ember.Component.extend({
});
MyIfComponent.reopenClass({
positionalParams: ['predicateValue']
});
export default MyIfComponent;
{{#if predicateValue}}
Yay!
{{yield}}
{{ else }}
😢
{{yield to="inverse"}}
{{/if}}
{
"version": "0.4.17",
"EmberENV": {
"FEATURES": {}
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js",
"ember": "https://cdnjs.cloudflare.com/ajax/libs/ember.js/2.2.0/ember.debug.js",
"ember-data": "https://cdnjs.cloudflare.com/ajax/libs/ember-data.js/2.2.0/ember-data.js",
"ember-template-compiler": "https://cdnjs.cloudflare.com/ajax/libs/ember.js/2.2.0/ember-template-compiler.js"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment