Skip to content

Instantly share code, notes, and snippets.

View k-fish's full-sized avatar
🐟

Kev k-fish

🐟
  • Toronto, Canada
View GitHub Profile
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
@k-fish
k-fish / components.my-component.js
Created June 23, 2016 17:42
Parent child components
import Ember from 'ember';
export default Ember.Component.extend({
clickFunction: Ember.on('click', function() {
window.alert('component clicked');
}),
});
@k-fish
k-fish / components.my-component.js
Created June 23, 2016 18:08
Double bound input example
import Ember from 'ember';
export default Ember.Component.extend({
total: 1000,
actions: {
changedPercentage: function(value) {
console.log('p' + value);
},
@k-fish
k-fish / components.my-component.js
Created June 23, 2016 18:14
Double bound fields 2
import Ember from 'ember';
export default Ember.Component.extend({
total: 1000,
actions: {
changedPercentage: function(value) {
this.set('amount', value * this.get('total'));
},
changedAmount: function(value) {
@k-fish
k-fish / components.my-component.js
Created June 24, 2016 15:35
Bound change event
import Ember from 'ember';
export default Ember.Component.extend({
foobar: 1,
actions: {
didChange: function(event){
this.set('foobar' , 'a' + event.target.value)
console.log(event);
}
}
@k-fish
k-fish / components.input-component.js
Last active July 18, 2016 15:52
Input wrapping approach custom formatting mut
import Ember from 'ember';
export default Ember.TextField.extend({});
import Ember from 'ember';
export default Ember.TextField.extend({
});
@k-fish
k-fish / controllers.application.js
Last active August 24, 2016 16:31
Transition refresh example (refresh post transition promise works)
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
@k-fish
k-fish / components.container-component.js
Last active September 30, 2016 18:04
Input change example
import Ember from 'ember';
export default Ember.Component.extend({
});
@k-fish
k-fish / adapters.post.js
Created October 24, 2016 13:03
Working Ember Data 1.13 Embedded Records
import Ember from 'ember';
import DS from 'ember-data';
const { RSVP } = Ember;
export default DS.RESTAdapter.extend({
findAll(store, type, sinceToken, snapshotRecordArray) {
return RSVP.resolve({
posts: [{
id: 1,