Usage

See ng-annotate's documentation and the test sources for details about the patterns that can be automatically detected by ng-annotate and this plugin, as well as information about how to explicitly mark functions and classes for annotation.

ES6 Annotations

This plugin can annotate some ES6 classes and arrow functions that are not supported by ng-annotate:

Implicit arrow function annotation

Arrow functions may be annotated anywhere that a "regular" function expression may be used.

NOTE: There are places where you shouldn't use arrow functions in an Angular application. Inside of an arrow function, the value of this is inherited from the lexical scope enclosing the function. For this reason, arrow functions should not be used to declare Angular services or providers.

If you choose to ignore this warning, we'll add the annotations to your services and providers anyway, but your application probably won't work. Future releases may treat this condition as an error.

Object Method Shorthand

Exports

Exported functions and classes may be annotated. Exported functions must have names:

/* @ngInject */exportdefaultfunctionsvc(dep1){}

Notes & Philosophy

This project/experiment does not seek to replace ng-annotate. However, it does seek to provide similar
functionality for Angular 1.x developers who are already using Babel and/or writing code in ES6.

Because of some of the limitations presented by Babel's transformation process, this project does not aim to
achieve feature parity, or provide identical output to ng-annotate. Notably, Babel does not preserve formatting
and indentations like ng-annotate does, and this project does not seek to replicate the features of ng-annotate that remove or transform existing annotations.

Initially, I had hoped to make very few modifications to the upstream sources, in the hopes of eventually
merging babel support directly into ng-annotate. Unfortunately, Babylon appears to have diverged too
far from Acorn to make that goal realistic. (I would love to be wrong here, and would welcome contributions that close the gap between the two projects!)