Adds implicit annotation support for directive definitions
that are returned from a variable.
angular.module('MyMod').directive('foo', function() {
var directive = {
// Ctrl wasn't annotated before, but will be now.
controller: function Ctrl(FooService) {},
};
return directive;
});
Currently, implicit annotations only work for a directive if the
directive definition is returned as an object literal.
angular.module('MyMod').directive('foo', function() {
return {
// Ctrl is correctly annotated.
controller: function Ctrl(FooService) {},
};
});
We have used the former quite a lot in our codebase, so we
needed to add support for it. I understand that the general
recommendation for more complex use cases like this is to add
explicit annotations, but here's a PR for the feature anyway
if you are interested. All the tests pass and I added one more
to test this specific case.
Adds implicit annotation support for directive definitions that are returned from a variable.
Currently, implicit annotations only work for a directive if the directive definition is returned as an object literal.
We have used the former quite a lot in our codebase, so we needed to add support for it. I understand that the general recommendation for more complex use cases like this is to add explicit annotations, but here's a PR for the feature anyway if you are interested. All the tests pass and I added one more to test this specific case.