Guards & Lazy Loading — Series 2

Preview — 3 of 10 questions

What does this lazy-load?

javascript
{ path: 'settings', loadComponent: () => import('./settings/page').then((m) => m.SettingsPage) }
AA standalone component and its own imports, in a separate chunk fetched when the route is first activated
BAn NgModule containing the component
CNothing — loadComponent only defers instantiation, not download
DThe whole feature folder, eagerly

What does this do that returning false does not?

javascript
export const authGuard: CanActivateFn = () =>
  inject(Auth).isSignedIn() ? true : inject(Router).createUrlTree(['/sign-in']);
AIt cancels the navigation and redirects to the returned URL as a single navigation, instead of cancelling and leaving the user where they were
BNothing; the router treats a UrlTree as false
CIt allows the navigation but rewrites the URL afterwards
DIt throws unless combined with canMatch

Where does this value live?

javascript
this.router.navigate(['/checkout'], { state: { cart } });
AIn the URL as a query parameter
BIn sessionStorage
CIn ActivatedRoute.data
DIn the browser's history entry — readable through router.getCurrentNavigation()?.extras.state during navigation, or history.state afterwards — so it survives back/forward but is absent on a fresh page load of that URL

Sign up free to play

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