December 2017
Beginner
372 pages
10h 32m
English
For generating services using Angular CLI, we use the same command, ng generate, but rather than the component, we use the service as the command option as shown here:
ng generate service trello.service
If we want to write this command using an alias, it will come out as shown here:
ng g s trello.service
Here, g stands for generate and s for service.
If we run this command, we will see two files generated by Angular CLI, one for the service and the other for the spec file as shown here:

As we can see, there are two things that are different in the case of a service as compared to generating a component:
Read now
Unlock full access