Astral Angular Annotator
A pass for Astral to generate AngularJS DI annotations automatically.
For a tool CLI, see `ngmin.
Usage
Below is an example parsing, annotating, and generating JavaScript code. Note that this requires the esprima
, escodegen
, astral
, and astral-angular-annotator
npm packages.
var esprima = escodegen = astral = ; // register angular annotator passastral; var inputCode = "angular.module('myMod').controller('FooCtrl', function ($scope) {" +" // ..." +"});"; var ast = esprima; astral; var generatedCode = escodegen; console; // logs://// angular.module('myMod').controller('FooCtrl', ['$scope', function ($scope) {// // ...// });
API
You can also access each of the individual passes like this:
This might be handy for more fine-tuned control.
License
MIT