Open the Terminal in Visual Studio Code, select OctopusCodes.com folder and go to your project directory.
Type the command “ng generate service product” on the command prompt to generate ProductService.
Angular CLI will generate 2 files in the app folder:
- product.service.spec.ts
- product.service.ts
To generate service in a specific folder, type the command “ng generate service services/product” on the command prompt to generate ProductService in services folder.
Angular CLI will generate 2 files in the services folder:
- product.service.spec.ts
- product.service.ts