Closed shannonhochkins closed 8 years ago
Hi! I don't understand what you're proposing. Can you please provide a minimal input example together with actual ng-annotate output as well as the output you propose? Thanks.
@olov believe this was the request
angular.module('foo').service(function (bar) {});
angular.module('foo').service(['baz.bar'], function (bar) {});
Where baz
is a configured namespace of some sort.
Don't see how this would work out (if you used a third party dependency ever).
Hi @olov, yes @omsmith has the correct example that I'm trying to replicate.
Basically I'm trying to namespace my providers so that they're easier to read and we know exactly what module they belong to etc.
Thanks. That seems to be outside outside of the scope for ng-annotate so I'm closing the issue.
@olov This seems to be a valid use case. If anyone is using ng-annotate in a large Angular App they going to hit this problem.
Perhaps, support for such cases can be achieved by adding some sort of aliasing syntax.
slots.api
, that's not a valid JS identifier and can't be used as an argument name. You can't write function(slots.api) { ... }
.api
as the argument name isn't gonna work either. If I want two dependencies foo.api
and bar.api
, which one should be referred to as api
? What about the other one?How about this?
// Source
angular.module('foo').service(function (api /*ng-from slots*/) {})
// Translates to
angular.module('foo').service(['slots.api', function (api) {}])
Or this:
// Source
angular.module('foo').service(function (/*ng-as slots.api*/ api) {})
// Translates to the same
angular.module('foo').service(['slots.api', function (api) {}])
This syntax should be optional and defined per dependency:
// Source
angular.module('foo').service(function (foo /*ng-from ns*/, bar, qux /*ng-from my*/) {})
// Translates to
angular.module('foo').service(['ns.foo', 'bar', 'my.qux', function (foo, bar, qux) {}])
It would
Let's say I have a simple API called:
I use ng-annotate in conjunction with gulp to automatically include my dependencies for minification.
However, I have recently changed the way I namespace my modules, so If I have a service that's specifically relating to the the slots module, I'll prefix it with slots.
However ng-annotate doesn't look like it supports that, is there a way to automatically do this with ng-annotate? so that the result would look something like: