| fun-with-di | Introduction to angular Dependency Injection |
| fun-with-promises | Introduction to Promises in Javascript |
- We talked about the motivation to use a dependency injection infrastructure
- We saw how to create a service - an object encapsulating a bit of logic and perhaps data
- We defined the terms:
- Consumer - the object that requires dependency
- Injection request - A consumer that asks for a dependency (service) in the constructor
- Injector - An object responsible for resolving (providing, injecting) the injection request
- Provider - The algorithm, or logic, used to resolve the injected object
- We saw how to define injecter and provider using the
providersproperty of a Module, or Component - We understood the effect of defining a component as injector, and how to use the component hierarchy as injector hierarchy
- We saw how to define a provider that used another class instead of the requested class
- We saw how to use the following explicit providers:
- Class provider
- Existing provider
- Value provider
- Factory provider
- Finally, we saw how to define a service as Injectable so it can also consume dependencies
- We saw the "tree shakable" syntax that uses the
@Injectabledecorator to set the root provider
- We saw the "tree shakable" syntax that uses the
- We defined a promise as an object that tells us if an action that takes time has completed, and what is the result
- We saw that we can not "pull" that information, but rather have to use the
.thenand.catchmethods and provide callbacks that will be called when the promise completes - We saw how to create a promise using the
Promise Constructor. - We understood what
asyncandawaitkeywords do and how do they affect the compilation