Skip to content

Instantly share code, notes, and snippets.

@rhettc
Last active December 30, 2015 23:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rhettc/7902073 to your computer and use it in GitHub Desktop.
Save rhettc/7902073 to your computer and use it in GitHub Desktop.
A look at controllers and templates
// Establishing routes
<script type="text/javascript">
Notes.Router.map(function () {
this.resource('notes', {path: "/"}, function() {
this.route('note', {path: "/note/:note_id"});
});
});
Notes.NotesRoute = Ember.Route.extend({
// Note here where we are "setting the subject for the index action"
model: function() {
return this.store.find('note');
}
});
</script>
<div class="list-group" style="margin-top: 10px;">
<!-- The controller reference points to the subject that was defined for the controller -->
{{#each controller}}
<div class="list-group-item">
{{name}}
</div>
{{/each}}
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment