Skip to content

Instantly share code, notes, and snippets.

@macu
Created March 5, 2014 15:12
Show Gist options
  • Select an option

  • Save macu/9369135 to your computer and use it in GitHub Desktop.

Select an option

Save macu/9369135 to your computer and use it in GitHub Desktop.
Ember naming conventions, compiled points (as of Ember v1.4.0)
<script type="text/x-handlebars">
The application template (outer scaffold) has no name, or has the name "application".
{{outlet}}
</script>
<script type="text/x-handlebars" data-template-name="dashboard">
This template embeds another view/controller/template combo with a hyphenated name.
{{render "users-list" visibleUsers}}
</script>
<script type="text/x-handlebars" data-template-name="users-list">
This template has a hyphenated name.
</script>
App.DashboardController = Ember.ObjectController.extend({
visibleUsers: [/* available in the dashboard template */]
});
App.UsersListController = Ember.ArrayController.extend({});
// Route for the standalone users list.
App.UsersListRoute = Ember.Route.extend({
model: function() {/* returns a list of users */},
setupController: function(controller, users) {
controller.set('model', users);
},
});
App.Router.map(function() {
this.resource('dashboard');
// Standalone users list.
// Use a hyphen in the route name, to associate with template name.
this.resource('users-list', {path: '/users'});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment