Bird
0
0

How can you access the resolved data inside a component after navigation?

hard📝 Application Q9 of 15
Angular - Advanced Patterns
How can you access the resolved data inside a component after navigation?
AInject Resolver service directly in component
BSubscribe to ActivatedRoute.data observable
CUse a global variable set by Resolver
DCall Resolver's resolve method manually in component
Step-by-Step Solution
Solution:
  1. Step 1: Recall how resolved data is passed

    Resolved data is available on ActivatedRoute's 'data' observable property.
  2. Step 2: Check other options

    Injecting Resolver or calling resolve manually is not standard; global variables are bad practice.
  3. Final Answer:

    Subscribe to ActivatedRoute.data observable -> Option B
  4. Quick Check:

    Access resolved data via ActivatedRoute.data [OK]
Quick Trick: Use ActivatedRoute.data to get resolved data [OK]
Common Mistakes:
  • Injecting Resolver service directly in component
  • Trying to call resolve manually

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes