babel-plugin-angularjs-annotate
babel-plugin-angularjs-annotate copied to clipboard
Annotation doesn't work for a controller with name as a variable
And probably with any other .module api
I use webpack and angular
import angular from 'angular';
const MY_CONTROLLER = 'myController';
angular.module('myApp').controller(MY_CONTROLLER, $scope => {});
export default MY_CONTROLLER;
There's some history here about why this is difficult: https://github.com/olov/ng-annotate/issues/22
In general, in this use-case (and all use-cases, really), I strongly recommend using the explicit 'ngInject';
prologue directives (and explicitOnly
configuration option) to annotate your functions.
Also, in your specific example, I'd advise against using a lambda function for a controller declaration, as you'll have no way of accessing your controller's of this
.
I'll leave this open, as it's something that we could hypothetically support some day. However, I want to lean on the side of caution when making any changes that could introduce false-positives.