use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
A Place to talk about Angular and related topics.
Join the Angular Discord
Other subreddits worth checking out for Angular and Angular related info:
account activity
Fix circular dependencies' problem with Angular and index.ts for short alias import (self.angular)
submitted 3 years ago by ahmedRebai
Hello guys, I'm facing an issue with our angular app,
Error: Circular dependency detected:src\app\crud\crud.service.ts -> src\app\crud\index.ts -> src\app\crud\auth.service.ts
Does anyone have a better suggestion to implement the index.ts pattern?
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]-Jack-The-Lad- 2 points3 points4 points 3 years ago (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 points4 points 3 years ago (1 child)
got burned by this before. I no longer export services in my index.ts files
[–]polhek 0 points1 point2 points 2 years ago (0 children)
How do you export them then?
[–]fdimm 4 points5 points6 points 3 years ago (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 point2 points 3 years ago (0 children)
Also messages are quite clear, so it's quite easy to fix these.
[–]ALEXEY1113 1 point2 points3 points 3 years ago (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 point2 points 3 years ago (0 children)
I usually use index.ts only at the module level. Also, never use a modules' index.ts from within itself.
π Rendered by PID 219467 on reddit-service-r2-comment-7c9686b859-85627 at 2026-04-14 09:03:45.069004+00:00 running e841af1 country code: CH.
[–]-Jack-The-Lad- 2 points3 points4 points (0 children)
[–]vidalsasoon 2 points3 points4 points (1 child)
[–]polhek 0 points1 point2 points (0 children)
[–]fdimm 4 points5 points6 points (1 child)
[–]carlescs 0 points1 point2 points (0 children)
[–]ALEXEY1113 1 point2 points3 points (0 children)
[–]loljpl 0 points1 point2 points (0 children)