@zdychacek/babel-plugin-ng-inject-classes

1.2.0 • Public • Published

babel-plugin-ng-inject-classes

Annotates decorated AngularJS classes.

How to install

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.

How to setup

.babelrc

{
  "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.

How to use

Transforms this code:

@Component('foo')
class Foo {
  constructor($timeout, $element) {}
}

into this:

@Component('foo')
class Foo {
  constructor($timeout, $element) {}
}
Foo.$inject = ['$timeout', '$element'];

Dependents (0)

Package Sidebar

Install

npm i @zdychacek/babel-plugin-ng-inject-classes

Weekly Downloads

1

Version

1.2.0

License

MIT

Last publish

Collaborators

  • zdychacek