Skip to content

Instantly share code, notes, and snippets.

@hergaiety
Created December 4, 2015 20:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hergaiety/6566632c8ce69f8f283f to your computer and use it in GitHub Desktop.
Save hergaiety/6566632c8ce69f8f283f to your computer and use it in GitHub Desktop.
New Twiddle
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle',
myBool: false,
actions: {
toggleBool: function() {
this.set('myBool', !this.get('myBool'));
}
}
});
{{#if myBool}}
Controller's bool is true
{{else}}
Controller's bool is false
{{/if}}
{{my-comp1 myBool=myBool toggleBool="toggleBool"}}
{{my-comp2 myBool=myBool toggleBool="toggleBool"}}
import Ember from 'ember';
export default Ember.Component.extend({
actions: {
toggleBool: function() {
this.sendAction('toggleBool');
}
}
});
{{#if myBool}}
Comp 1's bool is true
{{else}}
Comp 1's bool is false
{{/if}}
<button {{action "toggleBool"}}>Toggle Bool</button>
import Ember from 'ember';
export default Ember.Component.extend({
actions: {
toggleBool: function() {
this.sendAction('toggleBool');
}
}
});
{{#if myBool}}
Comp 2's bool is true
{{else}}
Comp 2's bool is false
{{/if}}
<button {{action "toggleBool"}}>Toggle Bool</button>
{
"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