So in my case i have an angularJS application but i think this question really applies to any Single Page App.
I'm using a component structure as described in various articles like this, and this.
So let's suppose i have a structure like the one in John Papa's example
app/
app.module.js
app.config.js
app.routes.js
directives.js
layout/
shell.html
shell.controller.js
topnav.html
topnav.controller.js
people/
attendees.html
attendees.controller.js
speakers.html
speakers.controller.js
speaker-detail.html
speaker-detail.controller.js
sessions/
sessions.html
sessions.controller.js
session-detail.html
session-detail.controller.js
services/
data.service.js
localstorage.service.js
logger.service.js
spinner.service.js
Here's some questions about what's the best way (by your experience) to follow this paradigm, what can go wrong and how to avoid future problems with the directory structure posing that we are talking about a big application that will change and become bigger with time:
If
spinner.service.js
is only used inside thelayout
controllers, should i put it in the/layout
folder? Or any service should always be inside a generic folder?Suppose i want to use
/people/speakers
also as a partial inside another page, let's say/admin/speakers
. How do i manage this? Makingspeakers
a standalone component on the same level of/people
and/admin
?So as a more generic question whenever i have both a
detail view
of an item and alist view
that shows a list of those items: it's better to put everything inside the/item
folder (like in this example)?