What is the purpose of an Angular Resolve guard vs ngOnInit?

Tests routing lifecycle timing and UX state management. Strong answers: Resolve blocks activation until data returns; ngOnInit renders first then fetches, causing flicker.
Tests Angular router lifecycle and eager versus lazy data fetching UX. Strong answers cover four things: first, Resolve blocks route activation until data emits, making it synchronous in the component; second, ngOnInit fires after display, forcing internal skeleton and error states; third, the UX problem is flicker, layout shift, and awkward cancellation when fetches fail after navigation; fourth, modern Resolve supports RedirectCommand for graceful pre-render redirects.
Read the original → angular.dev
- #angular
- #routing
- #guards
- #resolve
- #ux
Get five bites like this every day.
Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.