In this lecture, we are going to create a service with the help of U.S. ally.
The service will be created inside the app directory.
That might sound strange since we have the shared module.
Typically, it's recommended to define components, directives and pipes inside a shared module.
We can define services and other modules.
But if the service is available globally, we should declare them in the app module inside the command
line.
We will run the following command energy generate service services slash mode all.
The Service Sub Command will instruct Angular to create a service.
This command is followed by the name of the file.
In this example, we are creating a folder called services before creating the mobile service.
We are going to organize our global services in a single directory.
After running this command, two files should have been created.
The first file is the service itself.
We can find it inside these services folder under the name modal dot service.
That's.
The other file is called Modal Dot Service Dot suspects.
This is a test file, which we will be ignoring.
We are going to focus solely on the service class files.
Everything inside this file is pretty normal, except for this decorator called injectable.
We will talk about this decorator in a future lecture.
For now, we will leave it in place.
Let's begin using our service in the next set of lectures.