I write services and controllers in my app (Angularjs - 1.6.3) using es6 classes.
I want to simplify some piece of code but don't know whether it's possible and how to get es6 class constructor arguments list.
Example of piece i need to simplify to prevent duplication:
class MyService {
constructor (
$q,
$translate,
) {
this.$q = $q;
this.$translate = $translate;
}
}
angular
.module('app')
.service('myService', MyService);
Is there any way to add dependencies to given context automatically?
Know that in angular2 there are decorators which helps not to duplicate dependencies to add them in current scope (or they do this any other way)