I have an Angular 2 application. For mocking the Document
object in tests, I'd like to inject it to the service like:
import { Document } from '??'
@Injectable()
export class MyService {
constructor(document: Document) {}
}
The Title
service of Angular uses the internal getDOM()
method.
Is there any simple way to inject the Document
to the service? Also, how should I reference it in the providers
array?