1 00:00:00,150 --> 00:00:05,040 In this lecture, we are going to create a service with the help of U.S. ally. 2 00:00:05,430 --> 00:00:08,910 The service will be created inside the app directory. 3 00:00:09,240 --> 00:00:12,660 That might sound strange since we have the shared module. 4 00:00:12,930 --> 00:00:19,260 Typically, it's recommended to define components, directives and pipes inside a shared module. 5 00:00:19,560 --> 00:00:22,230 We can define services and other modules. 6 00:00:22,410 --> 00:00:29,070 But if the service is available globally, we should declare them in the app module inside the command 7 00:00:29,070 --> 00:00:29,580 line. 8 00:00:29,610 --> 00:00:36,060 We will run the following command energy generate service services slash mode all. 9 00:00:38,580 --> 00:00:43,110 The Service Sub Command will instruct Angular to create a service. 10 00:00:43,470 --> 00:00:46,050 This command is followed by the name of the file. 11 00:00:46,320 --> 00:00:52,470 In this example, we are creating a folder called services before creating the mobile service. 12 00:00:52,800 --> 00:00:57,150 We are going to organize our global services in a single directory. 13 00:00:57,480 --> 00:01:01,500 After running this command, two files should have been created. 14 00:01:02,070 --> 00:01:04,680 The first file is the service itself. 15 00:01:04,980 --> 00:01:10,010 We can find it inside these services folder under the name modal dot service. 16 00:01:10,020 --> 00:01:10,950 That's. 17 00:01:13,460 --> 00:01:18,170 The other file is called Modal Dot Service Dot suspects. 18 00:01:18,530 --> 00:01:21,350 This is a test file, which we will be ignoring. 19 00:01:21,680 --> 00:01:25,490 We are going to focus solely on the service class files. 20 00:01:25,880 --> 00:01:31,280 Everything inside this file is pretty normal, except for this decorator called injectable. 21 00:01:31,640 --> 00:01:34,670 We will talk about this decorator in a future lecture. 22 00:01:34,940 --> 00:01:37,070 For now, we will leave it in place. 23 00:01:37,370 --> 00:01:41,090 Let's begin using our service in the next set of lectures.