Created
March 5, 2014 15:12
-
-
Save macu/9369135 to your computer and use it in GitHub Desktop.
Ember naming conventions, compiled points (as of Ember v1.4.0)
This file contains hidden or 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
| <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> |
This file contains hidden or 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.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