Skip to content

Problems with ActivatedRoute in Standalone Component #3634

Discussion options

You must be logged in to vote

Hi there,

ActivatedRoute isn't a part of RouterModule, it's defined in .forRoot and in .forChild.
Because your component imports RouterModule only, you need to provide ActivatedRoute additionally for TestBed.

Your last try with .provide is the right one and works correctly: https://codesandbox.io/s/sweet-rubin-mx7owq?file=/src/test.spec.ts

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@satanTime
Comment options

@Simon-TheHelpfulCat
Comment options

@satanTime
Comment options

Answer selected by satanTime
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants