Skip to content

Instantly share code, notes, and snippets.

@amritha-v
Created July 27, 2016 14:14
Show Gist options
  • Save amritha-v/a1f6bf5885ccbfebab67c620134a92bf to your computer and use it in GitHub Desktop.
Save amritha-v/a1f6bf5885ccbfebab67c620134a92bf to your computer and use it in GitHub Desktop.
New Twiddle
import Ember from 'ember';
export default Ember.Controller.extend({
appName: '4routeAmri',
test: 10,
numArr: [1,2],
compProp: Ember.computed(function() {
return 100;
}),
actions: {
add() {
console.log(this.get('compProp'));
this.compProp=200;
console.log(this.get('compProp'));
this.get('numArr').push(1);
this.set('test', this.get('test')+1);
}
}
});
<h1>Welcome to {{appName}}</h1>
<button {{action "add"}}>add</button>
<br>
{{#each numArr as |num|}}
<li>{{num}}</li>
{{/each}}
<br>
test:{{test}}
<br>
{{compProp}}
{{outlet}}
<br>
<br>
{
"version": "0.10.2",
"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.7.0",
"ember-data": "2.7.0",
"ember-template-compiler": "2.7.0"
},
"addons": {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment