Recently I started to use Visual Studio 2015 Community instead of Brackets. As it is said on a website, it has some kind of support of Angular, however, I did not even see it anywhere instead of HTML files. Even variable "angular", while hovering on it, prints
angular <type unknown>
I added an image to explain what I mean.
I tried to change JavaScript TextEditor References to Implicit (Web), however, after reboot, it comes back to Implicit (Windows).
I use Web Essentials and I know that it has feature to create Intellisense JS and TS files, however, this features are always disabled. I opened each directory in my project and checked it, this feature was always turned off.
In addition, I tried to create Scripts directory with _references.js manually, but it works very...baaad, I need to move it to another directory and return it into previous to make options like auto-sync available. The same thing is about _references.js
To make this case more cleaner: I create _references.js manualy. Now it has its Anto-Sync and Update References options. —> Reboot Visual Studio 2015 —> _references.js doesn't have such options anymore. However, even before reboot, if I update it, it will skip everything except app.js in root folder.
PS AngularJS IntelliSense works in HTML files, ie I can place ng-* attributes. So...I think, that something just doesn't work in VS 2015. PSS I use NodeJS for server-part of WebApp.
Well, I understand you are looking for a solution to work with Instellisense and Visual Studio, no matter what.
I am using Visual Studio also, but I moved to work with TypeScript. It is actually writing a kind of extended strongly typed JavaScript. That means you can declare the types of your variables. Example: var x:string = 'test';
There are of courses advantages and disadvantages. I like the advantages, that's why I used it.
*.ts
files to become *.js
files. *.d
files, which are in fact just header files for checking JavaScript function definitions. The #2 advantage is great. It prevents you to execute wrong code like:
setTimeout(myFunc, 'abc');
This wouldn't work for the second param should be a number, and not string. But as I said, you have to add the definition files to your TypeScript solution in order to work ok.
If you like trying that (you won't regret), follow these steps:
I believe this is an even better solution than just plain Intellisense, since it also prevents you from sending wrong parameters to functions in angular. Since JavaScript allows any variable to be of any type, it is really hard to do a code review when anything in your JS breaks. With TS, this shouldn't happen. If you do that, the compilation will fail.
Have you tried using this at the beggining of your js file where you want Intellisense?
/// <reference path="pathToAngular.js" />
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.