Last active
April 8, 2018 00:09
-
-
Save mdebbar/4c5705c404a8c5fc0e36dada1dc4c79b to your computer and use it in GitHub Desktop.
Child keys
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
const { computed } = Ember; | |
export default Ember.Component.extend({ | |
tagName: '', | |
text: computed.oneWay('todo.text'), | |
json: computed('todo.{id,text}', function() { | |
return JSON.stringify(this.get('todo')); | |
}), | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Component.extend({ | |
init() { | |
this._super(...arguments); | |
this.set('todos', [ | |
{id:1, text:'foo'}, | |
{id:2, text:'bar'}, | |
]); | |
}, | |
json: Ember.computed('todos.{id,text}', function () { | |
return JSON.stringify(this.get('todos')); | |
}), | |
actions: { | |
reverse() { | |
this.set('todos', this.get('todos').slice().reverse()); | |
}, | |
}, | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
appName: 'Ember Twiddle' | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": "0.13.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.13.0", | |
"ember-template-compiler": "2.13.0", | |
"ember-testing": "2.13.0" | |
}, | |
"addons": { | |
"ember-data": "2.16.3" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment