Dot notated namespacing
See original GitHub issueIt would
Let’s say I have a simple API called:
var app = angular.module('slots', []);
app.service('slots.api', function() {
return {
get : function() {
return true;
}
}
});
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:
app.service(['slots.api', function(api) {
var result = api.get();
}]);
Issue Analytics
- State:
- Created 8 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
527 – Defining a Nested Namespace Using Dot Notation
If you are defining a type that exists in a nested namespace, there are two ways to define the namespace. You can nest...
Read more >C++ COM Interop: Using C# namespace with dot notation in c++
using namespace A::B::C;. and I get error C2653: A is not a class or namespace. The unmanaged project is referencing the managed project...
Read more >Practice: Exploring Objects Using JavaScript: Dot notation
You accessed the object's properties and methods using dot notation. The object name (person) acts as the namespace – it must be entered...
Read more >JavaScript Dot Notation, Namespace or Object System?
am writing a JavaScript lib. My question is, to have method chaining or not. This post is sort of a log of my...
Read more >namespaces API - Read the Docs
Look up item via dot-notation. Parameters: name (str) – Key. Returns: Associated value. Usage::.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@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 writefunction(slots.api) { ... }
.api
as the argument name isn’t gonna work either. If I want two dependenciesfoo.api
andbar.api
, which one should be referred to asapi
? What about the other one?How about this?
Or this:
This syntax should be optional and defined per dependency: