Angular.js DI with (ES6) classes and inheritance Angular.js DI with (ES6) classes and inheritance angularjs angularjs

Angular.js DI with (ES6) classes and inheritance


it's not ES6 (it's ES7), but it just might float your boat

I would look into angular-decorators by MikeRyan52.

He's put together an @inject decorator that works as follows:

@inject('$http', '$rootScope')class SomeClass {  constructor($http, $rootScope) {  }}@inject('$q')class SubClass extends SomeClass {  constructor($q, ...parentDependencies) { /** parent dependencies caught with a rest parameter **/    super(...parentDependencies);  }}

the implementation of @inject


add this at the very bottom of SubService.js

SubService.$inject = ['$http', '$q', '$etc', '$more', '$di', '$things', '$here'];