October 2017
Intermediate to advanced
280 pages
6h 50m
English
Now, let's take a look at the Socket class. We decorate it with the @Injectable decorator. This decorator is supposed to be used by any class that accepts dependencies that should be injected via the DI mechanism of Angular.
The @Injectable decorator hints Angular that a given class accepts arguments which should be injected with the dependency injection mechanism of the framework. This means that if we omit the @Injectable decorator, Angular's DI mechanism will not know that it needs to resolve the dependencies of the class before it instantiates it.
Read now
Unlock full access