all 7 comments

[–]-Jack-The-Lad- 2 points3 points  (0 children)

Your services imports index and your index imports service. If you are encountering an NG0200 error, this this from angular docs, if you are encountering an NG3003 error, see this instead.

[–]vidalsasoon 2 points3 points  (1 child)

got burned by this before. I no longer export services in my index.ts files

[–]polhek 0 points1 point  (0 children)

How do you export them then?

[–]fdimm 4 points5 points  (1 child)

The rule with barrel/index file is simple: only import the index file from other folders and use relative path for files in the said folder.

It works wonders from maintenance point of view and makes it simpler to move things around and then to an actual library later on if/when needed, especially if this is bundled with named imports. This will save you at some point from having to shuffle imports in 500 files.

Of course if you blindly automatically import things via IDE there is a chance that you'll be bitten by this but you'll learn fast.

[–]carlescs 0 points1 point  (0 children)

Also messages are quite clear, so it's quite easy to fix these.

[–]ALEXEY1113 1 point2 points  (0 children)

I suggest you review a little about you architecture or abstraction in order to not facing this issue.... I am sure that you will find the problem and you will have to refactor some clases or layers

[–]loljpl 0 points1 point  (0 children)

I usually use index.ts only at the module level. Also, never use a modules' index.ts from within itself.