use service in angular component code example
Example 1: angular new service
ng g s serviceName
Example 2: how to inject service in component angular 6
you can inject service in components constructor:
constructor(public anyService: Service){}
Example 3: angular import service
import { <service name>Service } from '../<service path>';