Angular Dependency Injection and Lazy Loaded Modules

  Рет қаралды 3,211

Juri Strumpflohner

Juri Strumpflohner

Күн бұрын

Let's explore the different ways of registering an Angular service with the dependency injection mechanism, in particular the peculiarities when it comes to lazy loaded Angular Modules.
Repo: github.com/jur...
Blog post: juristr.com/bl...

Пікірлер: 8
@Kotfluegel
@Kotfluegel 3 жыл бұрын
This doesn't answer the question, of which lazy chunk ships the code for this service? I guess the service's code still ends up in the main chunk? Or does the DataServiceModule produce it's own lazy loaded module, which get's fetched as either Feature1 or Feature2 is being activated?
@juristr
@juristr 3 жыл бұрын
Check the linked blog post in the description or play around with the provided code example. That should make it pretty evident 🙂
@hsemog
@hsemog 3 жыл бұрын
Great explanation! Although I would also like to hear your opinion on the pros and cons of example providedIn: DataAccessModule
@juristr
@juristr 3 жыл бұрын
Might be a good occasion for another video. I'll note it down!
@artempalamarchuk2605
@artempalamarchuk2605 3 жыл бұрын
the main problem of this approach it is circular dependencies
@hsemog
@hsemog 3 жыл бұрын
@@artempalamarchuk2605 yes i know that, and that’s easily fixable with an empty dedicated module. Still I’m just curious if that offers any benefit regarding DI.
@artempalamarchuk2605
@artempalamarchuk2605 3 жыл бұрын
@@hsemog as for me better to use just simple 'providers' instead syntax (tree-shaking not so necessary in many cases) rather than create additional module just for import/export
Angular Services and the impact on the final bundle size
5:09
Juri Strumpflohner
Рет қаралды 1,7 М.
Angular dependency injection in depth -  Dependency providers (2021)
17:19
PIZZA or CHICKEN // Left or Right Challenge
00:18
Hungry FAM
Рет қаралды 15 МЛН
1, 2, 3, 4, 5, 6, 7, 8, 9 🙈⚽️
00:46
Celine Dept
Рет қаралды 89 МЛН
風船をキャッチしろ!🎈 Balloon catch Challenges
00:57
はじめしゃちょー(hajime)
Рет қаралды 63 МЛН
😜 #aminkavitaminka #aminokka #аминкавитаминка
00:14
Аминка Витаминка
Рет қаралды 3,1 МЛН
Services in Angular - Learning Angular (Part 6)
14:05
Angular
Рет қаралды 53 М.
ProvidedIn root vs any in angular | Angular Tutorial
11:03
WebGentle
Рет қаралды 4,5 М.
Lazy Loading - Angular (Tutorial #29)
10:44
Nisha Singla
Рет қаралды 34 М.
10 common mistakes with the Next.js App Router
20:37
Vercel
Рет қаралды 227 М.
#10 модули и lazy loading | Уроки Angular для начинающих
44:19
Алексей Соловей
Рет қаралды 484
Learn NgModule in Angular with Examples
5:59
Fireship
Рет қаралды 117 М.
PIZZA or CHICKEN // Left or Right Challenge
00:18
Hungry FAM
Рет қаралды 15 МЛН