Skip to content

Instantly share code, notes, and snippets.

@kalyco
Created June 9, 2015 15:26
Show Gist options
  • Save kalyco/b8224344d411843ddd29 to your computer and use it in GitHub Desktop.
Save kalyco/b8224344d411843ddd29 to your computer and use it in GitHub Desktop.
ember controllers are different from rails controllers in that their primary function is to provide the logic to access data from the model. In this example, the user has different first_name, last_name properties, but wants to show a full name. This is something that a controller would be used for.
App.UserController = Ember.Object.Controller.extend({
fullName: function() {
return this.get("first_name") + " " + this.get("last_name");
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment