This project was generated using Angular CLI version 14.2.13.
You can explore a live demo of this project on StackBlitz. Click the link below to interact with the application and see its features in action:
You can find the full source code for this project on GitHub:
Run ng serve
to start a development server. Navigate to http://localhost:4200/
. The application will automatically reload if you make changes to any of the source files.
Run ng generate component component-name
to create a new component. You can also use ng generate directive|pipe|service|class|guard|interface|enum|module
.
Run ng build
to compile the project. The build artifacts will be stored in the dist/
directory.
This project implements lazy loading for modules, components, and services, optimizing application performance by loading only what is necessary when accessing each module.
Each module is associated with its own JS chunk, which includes both the module code and the necessary logic to interact with the data. This means that when you navigate to a specific section of the application, the corresponding JS chunks are downloaded, and the required data is retrieved using the services included in those chunks.
Thanks to ngrx-store-localstorage, localStorage
is automatically synchronized with the Redux state, allowing the application state to be restored upon restarting.
Effects are used to handle asynchronous interactions and data loading operations within the application. In this project, they facilitate the efficient loading of list data and manage actions for adding and removing products.
The application is integrated with Redux DevTools, which allows you to visualize and debug state changes easily. You can install the corresponding browser extension and use it to monitor state changes.
- Initial Screen: Displays the main view upon loading the application.
- Login Screen: Shows how the user logs in and the information is saved in Redux storage.
- Loading the
Weather
Module: Demonstrates how the corresponding JS file for theWeather
module is downloaded when navigating to this section, and how the information is fetched and saved in Redux storage. - Loading the
List
Module: Shows how the JS file for theList
module is downloaded when accessing the shopping list and how the information is fetched and saved in Redux storage. - Adding Products to the List: Demonstrates how products are added to the shopping list.
To add a new module to this application, you need to make several changes to integrate it properly into the existing structure:
-
Import the New Module: You must import the new module into your
AppModule
. This is done by modifying theimports
array to include the necessary imports for the new module and its associated components. This will also include thelocalStorageSyncReducer
for state persistence. Ensure that you add the key'new'
in thelocalStorageSync
configuration to persist its state. -
Update the Navigation: In the header component or wherever the navigation links are defined, add a new link for the new module. This allows users to easily navigate to the newly added feature.
-
Configure Routing: Update the routing configuration in
AppRoutingModule
to include a route for the new module. This will typically involve adding a new path to theRoutes
array that points to the lazy-loaded module. The structure should look like this:- Add a new route object with the path set to
'new'
and configure it to load the new module using the dynamic import syntax.
- Add a new route object with the path set to
After making these changes, the application will recognize the new module and load it when the specified route is accessed.
This project uses ngrx-store-localstorage to persist the application state in the local storage of the user's device. This means that when interacting with the application, data such as the shopping list, preferences, and session information may be stored on your device.
Please note the following:
- Local storage is used to persist certain state data of the application.
- Data stored locally remains on your device and is not sent to external servers unless specified otherwise in the application logic.
- You can manually delete this data by clearing the local storage of your browser or using functions within the application to reset the state.
- Open your browser's development tools (
F12
orCtrl + Shift + I
/Cmd + Option + I
). - Navigate to the Application tab (for Chrome) or Storage (for Firefox).
- In the Local Storage section, locate and delete the data stored for
http://localhost:4200/
or the respective domain.
For further assistance with Angular CLI, use ng help
or refer to the Angular CLI Overview and Command Reference page.