Excuse a noob for asking something that is probably obvious to many but i’m having a hard time distinguishing the differences between these in practice. I understand in theory this is how it works.
Given a directory structure like this (i’m using PODs by the way)
pods/Portal |- route.js |- controller.js |- template.hbs |- view.js
- Route.js handles generating the model, route authorization, and redirection
- controller.js handles actions that manipulate the model and manipulate template specific properties (ie. commentsVisible)
- Template.hbs contains my view code
- View.js (i’m not too sure how it fits in here)
But in reality i have seen the following
- Route.js can handle actions from template.hbs but can’t set template properties not contained in the model
- Controller.js can manipulate the DOM in actions but can’t perform setup work upon the DOM.
- View allows manipulation of the DOM upon setup and also allows actions
So where does this distinction actually exist? It looks like views and controllers are doing the same job and routes and controllers share a good portion of the job. Where is the line i need to draw?
I’ve heard a lot of people talk about moving everything to components instead but it seems kinda awkward to wrap template specific logic inside a global level component just because it wraps up nicely.