0

Cannot find module '../../myservice;' or its corresponding type declarations.

By having the service as Injectable with providedIn root , this should be available throughout the project right?

@Injectable({ providedIn: 'root', })

I have them in both services. Has anyone faced similar issues ?

I have tried importing myservice from the other service but it says the service that I am looking for is not found

unable to import actually

  • `@Injectable({ providedIn: 'root' })` should be all you need. Make sure you have the `export` keyword before the service's class definition! e.g. `export class MyService {}` – nate-kumar Jan 11 '23 at 15:30
  • Should the export member name match the name we defined in the service class? i.e. import {MyService} from 'path/my-service' – Saravananand Krishnamani Jan 11 '23 at 15:37
  • Not necessarily, it is just a normal class for the most part so the name can be anything :) Could be worth trying to create a minimal reproducible example in Stackblitz? Sometimes just attempting to do so helps you spot where you're going wrong. If you manage it, then that will be helpful in spotting where the error lies – nate-kumar Jan 11 '23 at 15:49
  • Thanks for your help and suggestions on stackblitz. I really did not know what went wrong the error has gone when I recreated the service in vs code with the same name as export member name. – Saravananand Krishnamani Jan 12 '23 at 10:06

0 Answers0