I want to inject a service into a class that is not a component.
For example:
Myservice
import {Injectable} from \'
If your service methods are pure functions, a clean way to solve this is to have static members in your service.
your service
import {Injectable} from '@angular/core';
@Injectable()
export class myService{
public static dosomething(){
//implementation => doesn't use `this`
}
}
your class
export class MyClass{
test(){
MyService.dosomething(); //no need to inject in constructor
}
}