codejump

Router Internals

Preview — 3 of 10 questions

When and how do you implement a custom UrlSerializer?

ATo add authentication tokens to all URLs automatically
BTo customize how Angular parses and serializes URLs — e.g., supporting non-standard URL formats, custom encoding, or legacy URL schemes
CTo compress URL parameters for shorter links
DTo implement server-side URL rewriting for Angular Universal

In what order do these router events fire? NavigationStart, ActivationEnd, GuardsCheckEnd, ResolveEnd, RoutesRecognized

ARoutesRecognized → NavigationStart → GuardsCheckEnd → ResolveEnd → ActivationEnd
BNavigationStart → GuardsCheckEnd → RoutesRecognized → ActivationEnd → ResolveEnd
CNavigationStart → RoutesRecognized → GuardsCheckEnd → ResolveEnd → ActivationEnd
DNavigationStart → GuardsCheckEnd → ResolveEnd → RoutesRecognized → ActivationEnd

How would you implement a preloading strategy that preloads only when the user has a fast connection?

AUse PreloadAllModules with a custom delay
BPreloading is binary — either all modules or none; per-module conditions are not supported
CUse withPreloading(NetworkAwareStrategy) where NetworkAwareStrategy is provided by Angular
DImplement PreloadingStrategy and check navigator.connection.effectiveType inside the preload() method

Sign up free to play

Answer all 10 questions (7 more), see explanations for every answer, and track your score.