A Babel plugin that adds Angular 1.x dependency injection annotations to ES5/ES6 code, supporting both explicit (`/* @ngInject */`) and automatic (implicit) annotation of common Angular patterns. Version 0.10.0 is the latest stable release; the plugin is in maintenance mode with infrequent updates. It is a fork of ng-annotate optimized for Babel users, offering reduced build times by avoiding a separate tool. It fully supports ES5, transpiled ES6, and raw ES6, including ES6 classes and arrow functions not covered by ng-annotate. Key differentiators: integration with Babel pipeline, ES6+ support, and `explicitOnly` option to restrict annotation to marked functions only.
npm install babel-plugin-angularjs-annotateVerified import paths — ran on the pinned version, not inferred.
Install the plugin, configure it in Babel, and see implicit class annotation output.
Use regular functions for services and providers: angular.module('app').service('MySvc', function($http) { ... });Replace 'ngInject' string with `/* @ngInject */` comment annotation.
Ensure all functions needing DI have explicit `/* @ngInject */` comment or set `explicitOnly: false`.
Manually add static $inject property if you prefer property-style annotation, or rely on plugin's output.
Run `npm install --save-dev babel-plugin-angularjs-annotate` and ensure it's in devDependencies.
Add AngularJS (e.g., `npm install angular`) and include it via script tag or bundler entry.
Ensure Babel 6+ is installed; check that the plugin is in the 'plugins' array (not 'presets').