2

In my ionic 4 project directory I am doing

ionic g service api/login to create service through cli. But I am getting

[ERROR] type must be one of: component, directive, page, pipe, provider, tabs (not service) Use the --help flag for more details.

then I seek for help ionic g --help so it giving me these examples

Examples:

$ ionic g
$ ionic g
$ ionic g component
$ ionic g directive
$ ionic g page
$ ionic g pipe
$ ionic g provider
$ ionic g tabs
$ ionic g component foo
$ ionic g page Login
$ ionic g page Detail --no-module
$ ionic g page About --constants
$ ionic g pipe MyFilterPipe

I cannot see service anywhere. How can I generate service an alternative way is also fine if you can suggest.

Yugandhar Chaudhari
  • 3,831
  • 3
  • 24
  • 40

1 Answers1

4

Use the command argument “provider” instead of service:

ionic g provider your-service 

The terms provider and service are synonymous here.

Yugandhar Chaudhari
  • 3,831
  • 3
  • 24
  • 40
Jay Ordway
  • 1,708
  • 2
  • 11
  • 33