Angular - TestingWhich Angular service is commonly used to trigger navigation programmatically in tests?AActivatedRouteBRouterCLocationDNgZoneCheck Answer
Step-by-Step SolutionSolution:Step 1: Identify the service responsible for navigationThe Router service provides methods like navigate() to programmatically change routes.Step 2: Eliminate other servicesActivatedRoute provides route info, Location manipulates browser history, and NgZone manages Angular zones, but none trigger navigation directly.Final Answer:Router -> Option BQuick Check:Navigation trigger service = Router [OK]Quick Trick: Use Router.navigate() to simulate route changes [OK]Common Mistakes:Using ActivatedRoute to navigateConfusing Location with RouterTrying to navigate with NgZone
Master "Testing" in Angular9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallPerf
More Angular Quizzes Advanced Patterns - Custom structural directives - Quiz 5medium Animations - Enter and leave animations - Quiz 10hard Internationalization and Accessibility - Keyboard navigation support - Quiz 3easy Server-Side Rendering - Pre-rendering static pages - Quiz 15hard Server-Side Rendering - Pre-rendering static pages - Quiz 5medium Server-Side Rendering - Pre-rendering static pages - Quiz 4medium Standalone Components - Standalone vs module-based decision - Quiz 6medium State Management - When NgRx is overkill - Quiz 10hard Testing - Component testing basics - Quiz 3easy Testing - Mocking services in tests - Quiz 15hard