This project was generated with Angular CLI version 17.3.6. It utilizes Angular Material for UI components.
- Angular Material: Provides a range of UI components that are aesthetically pleasing and conform to Material Design principles.
Before you begin, ensure you have the latest version of Node.js installed which includes npm (Node Package Manager). This will be used to run the development server and install dependencies.
Make sure the backend service is already running before you start this application. The frontend relies on the backend for all data management tasks. You can find the backend repository and setup instructions here: Backend Repository
To get started with this project, you first need to clone the repository to your local machine. You can do this by running the following command in your terminal:
git clone https://github.com/kamula/contact_form.git
cd contact_form
After cloning the repository, navigate to the project directory and install the dependencies:
npm install
This command will install all the necessary dependencies required to run the application.
To start the development server, run:
ng serve
Navigate to http://localhost:4200/
in your web browser. The application will automatically reload if you change any of the source files.
If your backend service is running on a different port or host, make sure to update the apiUrl
in the environments/environment.ts
and environments/environment.prod.ts
files accordingly to ensure the frontend can communicate with the backend effectively.
The contact form uses Angular's reactive form approach for validation:
- Required Fields: Each field (Full Name, Email, Message) is marked as required.
- Email Validation: The email field is validated for standard email format.
- Visual Feedback: Angular Material inputs display validation errors to the user as they interact with the form.
- Loading Indicator: Upon submission, a loading spinner indicates that the form is processing.
- Success and Error Handling: On successful form submission, a confirmation message is displayed. If an error occurs, a snack bar shows an error message detailing the failure.
To build the project for production, run:
ng build
The build artifacts will be stored in the dist/
directory. Use the --prod
flag for a production build.
Execute the unit tests via Karma by running:
ng test
Execute the end-to-end tests by running:
ng e2e
For further details on configuring the application or deploying it to a live server, refer to the official Angular CLI documentation.