Annotates decorated AngularJS classes.
npm install @zdychacek/babel-plugin-ng-inject-classes --save-dev
Note: this library depends on the syntax decorators plugin for parsing. Simply type npm install babel-plugin-syntax-decorators --save-dev
.
{
"presets": [ "es2015" ],
"plugins": [
"syntax-decorators",
[
"@zdychacek/babel-plugin-ng-inject-classes", {
"decoratorNames": [ "Component" ]
}
]
]
}
This plugin takes one option - decoratorNames
. This option allows you to define list of decorator names to parse.
Transforms this code:
@Component('foo')
class Foo {
constructor($timeout, $element) {}
}
into this:
@Component('foo')
class Foo {
constructor($timeout, $element) {}
}
Foo.$inject = ['$timeout', '$element'];