Skip to content

Instantly share code, notes, and snippets.

@danmeyers
Last active October 9, 2018 15:40
Show Gist options
  • Select an option

  • Save danmeyers/7d11d45c0c44dbe5c12022dd1309737f to your computer and use it in GitHub Desktop.

Select an option

Save danmeyers/7d11d45c0c44dbe5c12022dd1309737f to your computer and use it in GitHub Desktop.
New Twiddle
import Ember from 'ember';
export default Ember.Component.extend({
});
import Ember from 'ember';
export default Ember.Component.extend({
});
import Ember from 'ember';
import { computed } from '@ember/object';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
appNameJSON: computed('appName', function() {
return JSON.stringify(this.appName)
}),
value: true
});
<p>{ {my-component text="mut inside" click=(action (mut appName "newName"))} }</p>
{{my-component text="mut inside" click=(action (mut appName "newName"))}}
<p>{ {my-component click=(action (mut appName) "newName")} }</p>
{{my-component text="mut outside" click=(action (mut appName) "newName")}}
<b>Name: </b>
<p>{{appName}}</p>
<b>JSONized Name:</b>
<p>{{appNameJSON}}</p>
{{my-component2 text="Wrong way" clickAction=(action (mut value false))}}
{{my-component2 text="Right way" clickAction=(action (mut value) false)}}
Value: {{value}}
<button {{action clickAction}}>{{text}}</button>
{
"version": "0.15.1",
"EmberENV": {
"FEATURES": {}
},
"options": {
"use_pods": false,
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js",
"ember": "3.4.3",
"ember-template-compiler": "3.4.3",
"ember-testing": "3.4.3"
},
"addons": {
"ember-data": "3.4.2"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment