Introduction
In Visual Studio, we get IntelliSense support for JavaScript in our markup files (.html or .aspx) when we include these references using the <script>
tag.
<script src="Scripts/angular.js"></script>
<script src="Scripts/angular-route.js"></script>
But what if we are writing pure JavaScript (.js) files which will later be included in our markups. We look for IntelliSense pressing the Ctrl+Spacebar, but don’t find any and it gets really annoying, as we are so used to IntelliSense in Visual Studio.
In order to support IntelliSense in such files (.js), we have to add a /// <reference path="[file path]”>
tag to our JavaScript files, to activate the IntelliSense for the referenced JavaScript file.
An example below...
Here, we are getting expected JavaScript IntelliSense support.
Once our app.js is created, we add it to our markup as follows:
<script src="Scripts/angular.js"></script>
<script src="Scripts/angular-route.js"></script>
<script src="app/app.js"></script>
Our markup though would need the referenced JavaScript files included in the <script>
tags as well!