I’ve been researching the discussions about when to use a view, component, render, or helper. There seems to be some conflicting information, but it seems like the developers advise against using a view, but recommend using components instead. Ok, but what if I want my ‘component’ to be bound to a controller? I would think I would then use {{render}} or {{partial}} but my understanding is that these are not designed to be reusable; that’s what a component is for?
As an example:
Suppose I have a model, let’s call it a ‘Task’ that can be displayed in a list, and is editable in that list view. And suppose I have a couple lists of tasks, like ‘overdue’, ‘completed’, etc.
So, I want something reusable that I can plug into the templates in my ‘tasks/index.hbs’, ‘tasks/overdue.hbs’, and ‘tasks/completed.hbs’ templates. This reusable component/template needs to be bound to a controller so that I can do actions like edit the task, mark it complete, assign it to somebody else, whatever.
The question is, do I make a template “task/list-item” and render it with
{{#each}}{{partial “task/list-item”}}{{/each}} assuming the ‘itemController’ property is set to ‘taskListItemController’, or similarly would I use
{{#each}}{{render “task/list-item” this}}{{/each}}
Or do I define a component {{task-list-item}}, and if so, how would I bind it to the controller?