Advanced DI
Advanced DI is simple if you keep it on paper. Priya uses it for MarksService shared by two pages in the campus app.
Advanced DI on the board: @Injectable + constructor inject. Then say what MarksService shared by two pages looks like after.
Without Advanced DI, the campus app gets messy and MarksService shared by two pages is hard to trust.
Advanced DI shows up in the campus app. Name MarksService shared by two pages, not “a real-world scenario”.
Don’t do this with Advanced DI — new MarksService() in each component. Interviewers spot it in ten seconds.
After Advanced DI, Priya should still remember new MarksService() in each component.
One breath for Advanced DI, then MarksService shared by two pages, then new MarksService() in each component. Sit down.
MarksPage ──inject──► MarksService ReportPage ──inject──► MarksService one root instance
Say Advanced DI in one breath, then @Injectable + constructor inject, then new MarksService() in each component.