Services encapsulate data access and business logic away from components.
Important interview questions and answers
- Q: Why does this matter?
A: Services encapsulate data access and business logic away from components.
Self-check
- Summarize Services pattern in one sentence.
- What would you try next in the playground?
Challenge
Services pattern hands-on
- Edit the default code.
- Click Run in browser.
- Confirm preview or terminal output.
Done when: preview or terminal matches the lesson goal.
Pitfall: Putting HTTP calls directly in every component—extract a service and inject it once.