I
I
Ilya Trifonov2018-05-11 16:49:51
Angular
Ilya Trifonov, 2018-05-11 16:49:51

How do you organize/structure your Angular apps?

Do you use Core/Shared modules? How do you store models, services, configs: centrally or separately for each module? Do you have master pages and how do you use them? What does the folder structure of your project look like?
For example, I split my project like this:
./core - import once, use for authorization services, logging, configs, etc.
./configs
./auth
./other-features...
core.module.ts
./shared -import into each feature-module, use for reusable features, models
./models
./go-back
./grid-list
./other-features...
shared.module.ts
./public - public application pages, access to who are allowed to all
./modules * - home, help, etc
./public-master - module with a master page for public routes
public.routing.ts
public.module.ts
./secure - secure application pages accessed by rights
./modules * - settings, approval, etc
./secure-master - module with a master page for public routes
secure.routing.ts
secure.module.ts
* - modules have their own structure, for example settings
./modules/settings
./models - models
. /services - services
./features - module components
./pages - module pages (there is always a master page for a module, e.g. settings-master.page.ts represents a component)
settings.module.ts
settings.routing.ts
One of the issues that worries me now: I thought about moving all endpoint services (services for requesting data from the server) and all endpoint models somewhere to the root to be stored centrally. What for? Cases began to arise when a service or model of a lazy module was needed in another lazy module. What would you advise, what would you suggest, did you read the questions above? :)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Semenov, 2018-05-14
@w4_alex

I usually use the following structure:
--app
----layout
----modules
----pages (usually one page Not found)
----redux
----shared (shared for the entire application, usually the same logical split into folders)
------modules (common modules)
------models
------providers
------pipe

And for each module:
--modules
----module 1
------auth
--------layout
--------pages
--------shared (where models, services, components for pages of this particular module are located)
.. ..
----module N
------auth
--------layout
--------pages
--------shared (where models, services, components for pages of this particular module are located)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question