Created
July 23, 2015 16:47
-
-
Save timgthomas/c8ae28226b45d088dbae to your computer and use it in GitHub Desktop.
New Twiddle
This file contains 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
export default Ember.Component.extend({ | |
init() { | |
this._super(); | |
this.get('item').on('saved', this.itemSaved.bind(this)); | |
}, | |
itemSaved() { | |
this.$().css({ color: 'deeppink' }); | |
} | |
}); |
This file contains 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({ | |
actions: { | |
saveAllItems() { | |
this.get('model').forEach((m) => m.save()); | |
} | |
} | |
}); |
This file contains 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.Object.extend(Ember.Evented, { | |
save() { | |
this.trigger('saved'); | |
} | |
}); |
This file contains 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'; | |
var Router = Ember.Router.extend({ | |
location: 'none' | |
}); | |
Router.map(function() { | |
}); | |
export default Router; |
This file contains 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'; | |
import Item from '../models/item'; | |
export default Ember.Route.extend({ | |
model() { | |
return [ | |
{ name: 'Foo' }, | |
{ name: 'Bar' }, | |
{ name: 'Baz' } | |
]; | |
}, | |
setupController(controller, model) { | |
model = model.map((m) => Item.create(m)); | |
this._super(controller, model); | |
} | |
}); |
This file contains 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
body { margin: 12px 16px } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment