An experimental Babel transformer plugin for Angular 2 decorators and type annotations. Version 5.1.0 (last released in 2016) is the latest stable version, but the project is effectively abandoned with no updates since. It requires babel-plugin-transform-decorators-legacy for decorator support and transforms Flow-style type annotations into Angular's design:paramtypes metadata for dependency injection. Unlike the official Angular compiler, this plugin allowed using Angular 2 with Babel/Flow instead of TypeScript. However, it only supports Angular 2.x and has known issues with newer Angular versions and strict mode.
npm install babel-plugin-angular2-annotationsVerified import paths — ran on the pinned version, not inferred.
Installs the plugin and other required Babel plugins, then configures them in .babelrc to transpile Angular 2 decorators and type annotations.
npm install reflect-metadata and import it in your app
Migrate to Angular's official compiler or ngc
List 'angular2-annotations' before 'transform-decorators-legacy' in .babelrc
Provide an initializer (even undefined) for class properties
Run npm install --save-dev babel-plugin-angular2-annotations
Add 'transform-decorators-legacy' to plugins list in .babelrc
Install reflect-metadata (npm install reflect-metadata) and import it at the entry point
Ensure 'angular2-annotations' is in plugins list and appears before transform-decorators-legacy