Generating a Service

Available Schematics

The following schematics are available for use with the ng generate command:

Class

Component

Directive

Enum

Guard

Interface

Module

Pipe

Service

Updating Unit Tests

After adding new components or services, you might need to manually update previously generated spec files in order to keep all of your tests passing.

For example, if you add a new component named MyTest to your app and update the app.component.html template to render that component, you'll need to update the app.component.spec.ts file in order to keep your unit tests passing. Just import your new component and add it to the test bed's declarations array.