October 2017
Intermediate to advanced
280 pages
6h 50m
English
In ES2015, we are able to decorate only classes, properties, methods, getters, and setters. TypeScript takes this further by allowing us to decorate functions or method parameters:
class Http {
// ...
}
class GitHubApi {
constructor(@Inject(Http) http) {
// ...
}
}
Keep in mind that the parameter decorators should not alter any additional behavior. Instead, they are used to generate metadata. The most typical use case of these decorators is the dependency injection mechanism of Angular.
Read now
Unlock full access