Closed madskristensen closed 10 years ago
Ok, so it doesn't work in this case
app.js
var nameApp = angular.module('nameApp', ['ngRoute']);
nameController.js
nameApp.controller('nameController', ['$scope', '$location', 'testimonialFactory', function ($scope, $location, testimonialFactory) {
I do get Intellisense for nameApp
, but not for $location
inside the function.
If I change nameController.js
to do this, then it works:
angular.module("nameApp").controller('nameController', ['$scope', '$location', 'testimonialFactory', function ($scope, $location, testimonialFactory) {
Is it fixable?
Dude, this is extraordinary. It works!!!!! Thanks so much
Glad to do this. I must admit that it does just push the problem down one layer. If for instance your module was stored in a property of a global object then this solution wouldn't find it.
var container = {};
container.nameApp = angular.module('nameApp', ['ngRoute']);
I suppose the code block I added could be recursive, traversing the properties (and properties of properties) of objects off the window, but I suspect that could have an adverse impact on performance.
All of this is to work around the fact that you can't get a list of registered modules from AngularJS. If you could then that list could be your starting point and the module override and window traversal would be unnecessary.
Tried to get this to work and performance doesn't seem to be a problem, but the container is empty during traversal, which is odd and unexpected. I created an experimental branch to mess with this, but perhaps somebody who is a bit more versed in Visual Studio JavaScript intellisense could figure out why it isn't working as expected.
In my simple Angular app (https://github.com/madskristensen/betternamegenerator) I can't seem to make this work when the app is defined in one file and a controller in another.
Specifically, I don't get the Intellisense for
$location
in the file/app/controllers/nameController.js
I might be doing something wrong with ordering inside
_references.js
but no matter what I do it doesn't pick up the Intellisense.Am I doing something wrong?
Btw, I added _Intellisense.js to the global reference list in Tools -> Options -> JavaScript. It seems to work fine when I do everything in a single .js file, but not when I split up my logic as I normally would.