Last active
August 29, 2015 14:15
-
-
Save kellysutton/8074a30aa0d3d783c8a3 to your computer and use it in GitHub Desktop.
Reducing “action cruft” in your Ember templates
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
// app/components/post-detail.js | |
import Ember from 'ember'; | |
export default Ember.Component.extend({ | |
actions: { | |
startEditing: function () { | |
this.get('targetObject').send('startEditing', this.get('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
// app/controllers/posts/show.js | |
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
actions: { | |
startEditing: function (post) { | |
// Perform the logic to start editing the post | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment