According to this post intellisense should also be working on the new VS 2015, but so far I only get intellisense for the angular object and not for the dependencies or my c
None of the above work for me. Mine is Visual Studio 2017 - Professional
Yet I got it working using my solution here -->
/// <reference path="yourpath"/>
even the source is in the same folder where you code is.Although I can put the reference stmt inside my code file, I chose to use a separate file "_reference.js" to store it.
You can put this with your code :
/// <reference path="../_assets/JS-Main/angular-1.3.13.js" />
var app = angular.module('app', ['ui.grid', 'ui.bootstrap']);
app.controller('MainCtrl', ['$scope', '$http', function ($scope, $http) {
Or you can enter this line into your _reference.js file
/// <reference path="../_assets/JS-Main/angular-1.3.13.js" />
After you have done all the above, you should be able to see the angular intellisense.
You can do the same thing for others' intellisense like jQuery, Anytime, _underscore, etc... just keep adding path statements into the _reference.js file and you can also copy that _reference.js file to other websites if they have the same dir struct. Good luck!
Follow this article to add more comprehensive intellisense to VS.
http://blogs.msdn.com/b/visualstudio/archive/2015/02/05/using-angularjs-in-visual-studio-2013.aspx
Download the angular.intellisense.js file and place it in the Program Files (x86)\Microsoft Visual Studio 12.0\JavaScript\References folder
As @Balthasar pointed out (and in case you are using Resharper) you will need to enable intellisense from Visual Studio for it to work:
Resharper -> options -> environment -> intellisense -> general, select 'Custom Intellisense' and for Javascript you can select Visual studio. Alternatively you can use the 'Visual Studio' statement completion (second option)
I had the same issue. When I added angular, VS 2015 (RTM) modified my _references.js; basically it removed some of my lines in the file. When I added a reference for angula in my _references.js as below
/// <reference path="lib/angular/angular.js" />
I got my intellisense for Angular 1.4.3 in VS 2015!
So, even if everything is well configured with the _references.js file, and you get intellisense for other libraries like jQUERY, you will most probably not get it for AngularJS.
For example, in VS 2015 community, the below directive will not show intellisense for the $http angular object, although everything works fine with the code:
In the image below, I add an empty array to the module (which means that the module will get created, and if another with the same name exists, it get overwritten), and intellisense starts working:
Here is a snippet of the code for you to test yourself (try and add the empty array here):
(function () {
'use strict';
angular
.module('intellisence.sucks.directives')
.directive('footer', footer);
footer.$inject = ['$http'];
function footer($http) {
$http.
var directive = {
link: link,
restrict: 'EA'
};
return directive;
function link(scope, element, attrs) {
}
}
})();
PS: If you click on any folder on you project in the Solution Explorer and press Ctrl
+Alt
+A
to add a new item, you get suggestion to add a AngularJs Directive, and If you do it, the Directive will be like the one I just showed you, without the empty array on the module declaration, so intellisence won't work with it. It won't work with the example that Microsoft gives to the users... Only works on the module creation, your first file and doesn't work from now on.