Skip to content

Instantly share code, notes, and snippets.

@ryanto
Last active August 29, 2015 14:16
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 ryanto/cf1b1e8eb59db268bbed to your computer and use it in GitHub Desktop.
Save ryanto/cf1b1e8eb59db268bbed to your computer and use it in GitHub Desktop.
{{! because the template yields the actions can go
on the route/controller}}
{{#todo-list todos=todos as |todo|}}
{{#todo-item todo=todo as |todo|}}
{{input value=todo.name}}
<a href="#" {{action "save" todo}}>Save</a>
<a href="#" {{action "delete" todo}}>Delete</a>
{{#comments-list comments=todo.comments as |comment|}}
{{comment-item comment=comment as |comment|}}
{{! this component is just `yield this`, so it can
have it's own computed CP's and component scoped
helpers }}
{{textarea value=comment.text}}
{{comment.someCPOnTheCommentItemComponent}}
<a href="#" {{action "saveComment" comment}}>Save</a>
<a href="#" {{action "deleteComment" comment}}>Delete</a>
{{/comment-item}}
{{/comments-list}}
{{/todo-list}}
{{/todo-list}}
{{! yielding comments look more like html and they allow
all markup to be kept in the same template}}
{{! as your page gets bigger this gets harder because you
will have more and more actions on that page that all
end up in the router. }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment