Skip to content

Instantly share code, notes, and snippets.

@beth
Last active March 21, 2019 00:20
Show Gist options
  • Save beth/94d5b1d67ceeabd78d973a41b1026314 to your computer and use it in GitHub Desktop.
Save beth/94d5b1d67ceeabd78d973a41b1026314 to your computer and use it in GitHub Desktop.
New Twiddle
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'EmberSVG',
circleRadius: 10,
actions: {
changeRadius(amount) {
const currentRadius = this.get('circleRadius');
console.log('change radous', amount, currentRadius);
this.set('circleRadius', currentRadius + amount);
}
}
});
<h1>Welcome to {{appName}}</h1>
<br>
<br>
<button {{action "changeRadius" 1}}>+</button>
<button {{action "changeRadius" -1}}>-</button>
<svg viewBox="0 0 300 100">
<circle cx="50" cy="50" r="{{circleRadius}}" fill="grey" />
</svg>
{{outlet}}
<br>
<br>
{
"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