0

Let's say that I have a app folder which is the root folder of my application.

If I now have a child folder called "second" inside the app folder (app is the parent folder and the child folder is "second") will the child folder which also has a service and is provided in his own module BE VISIBLE in the parent folder if I use the service (import it from the child) in the app.component.ts and consume it's fields, methods, or will it be only visible in the child folder and nowhere else?

masterach
  • 437
  • 1
  • 6
  • 19
  • 2
    Which folder a service is stored in isn't related to where it will be available for injection. It only depends where you provide the service and where the module where the service is provided is imported. – Günter Zöchbauer Oct 20 '17 at 12:30
  • If I provided, which I have done at the child components level in the child module ("second folder") then it won't be visible in the parent folder? Or am I wrong? – masterach Oct 20 '17 at 12:32
  • Please create an example to reproduce in stackblitz.com. Your prosa explanation is way too confusing. As I said, the folder is irrelevant for where the service will be visible. – Günter Zöchbauer Oct 20 '17 at 12:33
  • I get it now, I had to read your comment multiple times xd You can add an anser if you want+25 – masterach Oct 20 '17 at 12:36

1 Answers1

1

Which folder a service is stored in isn't related to where it will be available for injection. It only depends where you provide the service and where the module where the service is provided is imported.

Günter Zöchbauer
  • 623,577
  • 216
  • 2,003
  • 1,567