eggheadio / egghead-design

Illustrations and design elements for egghead.io
http://egghead.io
25 stars 4 forks source link

Expose Services with the Angular Dependency Injector #97

Closed zacjones93 closed 6 years ago

zacjones93 commented 6 years ago

https://egghead.io/courses/expose-services-with-the-angular-dependency-injector

Services are an inherent part of an Angular application. It is where you should define your application logic, they keep the state of the application and allow to share that among different components. That said, components can ask for instances of services by specifying them as parameters of their constructor functions which will then provided at runtime by Angular’s dependency injection mechanism. While services themselves are mostly just plain ES2015 classes, there are some interesting things to discover, especially when it comes to dependency injection. We can define them at various levels within our application, which allows us to control the scope and visibility of a given service. We can furthermore alias old service definitions to new, existing services which is handy for refactoring scenarios and we also have the possibility to define so-called factory functions for fully taking control of how a given service is being constructed. In this course we will take a closer look and walk step by step through all of these scenarios.

MaggieAppleton commented 6 years ago

https://www.dropbox.com/sh/tcqtpok9mckuavo/AACJq5iOxUF80hIeQlAhJKwma?dl=0