In general, the structure of an app's architecture should be fairly simple:
1. Router
The router is going to direct your users to the initial page of your app, and then is going to navigate to the other pages of your app.
+----------------------+
| |
| |
| Router | <- http://mysite.com/dashboard
| |
| |
+-----------+-------+--+
|+ | |
+============| | +------------+
+============++ | |
+| | |
|| | |
++==============vv==++ +--------v--------+ +---v------------+
|| || | | | |
|| (Page) || | (Page) | | (Page) |
|| || | | | |
|| Heroes Dashboard || | Heroes List | | Hero Details |
|| || | | | |
|| || | | | |
|| || | | | |
++==================++ +-----------------+ +----------------+
2. Pages/Components
1. Data Requested from Service
|
++==================++ v
|| || +-----------------+
|| (Page) ++---------------> |
|| || | (Service) |
|| Heroes Dashboard || | |
|| <<- - - - - - - -+ Heroes Service |
|| || | |
|| || ^ +-----------------+
++=========+========++ |
| 2. Data Returned
|
+---------+--------+
| | <- 3. Data Fed to Components
| |
+---------v------+ +-----v---------+
| | | |
| (Component) | | (Component) |
| | | |
| Navigation | | Heroes List |
| Tabs | | |
| | | |
+----------------+ +---------------+
3. Services
Services are to allow your pages to access data (from network requests, local storage, etc.), and returns Models and Collections which are passed to your view components.
2. HTTP Request to Server
|
| +------------+
+-----------------+ v | |
| | | |
| (Service) +-----------> |
| | | Server |
| Heroes Service <- - - - - -+ |
| | | |
+----^-----+------+ ^ | |
| | | +------------+
| |
| | 3. HTTP Response Received
|
1. Data Requested from Service -> | |
|
| | <- 4. Data Models Returned
|
| |
++======+=====v=======++
|| ||
|| (Page) ||
|| ||
|| Heroes Dashboard ||
|| ||
|| ||
|| ||
++====================++
Next Article: Services