Skip to content

Instantly share code, notes, and snippets.

@kumkanillam
Created July 13, 2016 05:17
Show Gist options
  • Save kumkanillam/5c330e42c619a41fd61af7bfde3b1576 to your computer and use it in GitHub Desktop.
Save kumkanillam/5c330e42c619a41fd61af7bfde3b1576 to your computer and use it in GitHub Desktop.
mut and get helper
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
car:'Car initial value',
boat:'',
actions:{
getCarValue(){
console.log('car ',this.get('truck'));
}
}
});
import Ember from 'ember';
export default Ember.Route.extend({
model() {
return ['car', 'truck', 'boat'];
}
});
<h1>Welcome to {{appName}}</h1>
<br>
{{#each model as |vehicle index|}}
{{input value=(mut (get this vehicle))}}
{{/each}}
<button {{action "getCarValue"}}>Click</button><br>
CAR - {{car}} <br>
Truck - {{truck}}
<br>
{{outlet}}
<br>
<br>
{
"version": "0.10.1",
"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.6.0",
"ember-data": "2.6.1",
"ember-template-compiler": "2.6.0"
},
"addons": {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment