Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio 2013 AngularJS intellisense support

I thought VS 2013 is supposed to have support for angularjs attribute intellisense? For some reason it's not working for me on the latest version of Microsoft Visual Studio Ultimate 2013 version 12.0.21005.1

Getting the following validation warning: Attribute 'ng-app' is not a valid attribute of element 'html'.
Attribute 'ng-view' is not a valid attribute of element 'div'.

Am i missing an xsd reference somewhere?

like image 681
Henry O Avatar asked Oct 31 '13 14:10

Henry O


People also ask

How do I enable AngularJS IntelliSense in Visual Studio?

If you prefer to enable AngularJS intellisene for all of your web projects, simply save the angular. intellisense. js file to your %PROGRAMFILES%\Microsoft Visual Studio 12.0\JavaScript\References folder.

How do I enable IntelliSense in Visual Studio?

To access this options page, choose Tools > Options, and then choose Text Editor > C# > IntelliSense.


3 Answers

I had the same problem and I did the following and it helped.

If you are using ReSharper, you can add an extension that will give you Intellisense, and won't raise a warning.

Top Menu in VS>Resharper>Extension Manager>Search AngularJS This will add angular js intellisense.

-------EDIT-------

Using Resharper 8.2.1 Resharper Menu

enter image description here

like image 53
OmerBTW Avatar answered Oct 11 '22 05:10

OmerBTW


I know this is old, but it was still happening for me. To fix it for VS 2013, follow these instructions:

1) Open the file C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Packages\schemas\html\commonHTML5Types.xsd

2) Find the area in the file that starts with this line: <xsd:attribute name="translate">. Scroll down about 7 lines to find the corresponding closing tag: </xsd:attribute>

3) Just above the </xsd:attributeGroup> closing tag, paste the following lines of code:

<xsd:attribute name="ng-app" vs:category="Angular" />
<xsd:attribute name="ng-bind-html" vs:category="Angular" />
<xsd:attribute name="ng-bind-html-unsafe" vs:category="Angular" />
<xsd:attribute name="ng-bind-template" vs:category="Angular" />
<xsd:attribute name="ng-checked" vs:category="Angular" />
<xsd:attribute name="ng-class" vs:category="Angular" />
<xsd:attribute name="ng-class-even" vs:category="Angular" />
<xsd:attribute name="ng-class-odd" vs:category="Angular" />
<xsd:attribute name="ng-click" vs:category="Angular" />
<xsd:attribute name="ng-cloak" vs:category="Angular" />
<xsd:attribute name="ng-controller" vs:category="Angular" />
<xsd:attribute name="ng-csp" vs:category="Angular" />
<xsd:attribute name="ng-dblclick" vs:category="Angular" />
<xsd:attribute name="ng-disabled" vs:category="Angular" />
<xsd:attribute name="ng-form" vs:category="Angular" />
<xsd:attribute name="ng-hide" vs:category="Angular" />
<xsd:attribute name="ng-href" vs:category="Angular" />
<xsd:attribute name="ng-include" vs:category="Angular" />
<xsd:attribute name="ng-init" vs:category="Angular" />
<xsd:attribute name="ng-list" vs:category="Angular" />
<xsd:attribute name="ng-model" vs:category="Angular" />
<xsd:attribute name="ng-mousedown" vs:category="Angular" />
<xsd:attribute name="ng-mouseenter" vs:category="Angular" />
<xsd:attribute name="ng-mouseleave" vs:category="Angular" />
<xsd:attribute name="ng-mousemove" vs:category="Angular" />
<xsd:attribute name="ng-mouseover" vs:category="Angular" />
<xsd:attribute name="ng-mouseup" vs:category="Angular" />
<xsd:attribute name="ng-multiple" vs:category="Angular" />
<xsd:attribute name="ng-non-bindable" vs:category="Angular" />
<xsd:attribute name="ng-readonly" vs:category="Angular" />
<xsd:attribute name="ng-repeat" vs:category="Angular" />
<xsd:attribute name="ng-selected" vs:category="Angular" />
<xsd:attribute name="ng-show" vs:category="Angular" />
<xsd:attribute name="ng-src" vs:category="Angular" />
<xsd:attribute name="ng-style" vs:category="Angular" />
<xsd:attribute name="ng-switch" vs:category="Angular" />
<xsd:attribute name="ng-transclude" vs:category="Angular" />
<xsd:attribute name="ng-view" vs:category="Angular" />

Save the file and reopen VS2013. This should fix the issue.

like image 20
puargs Avatar answered Oct 11 '22 06:10

puargs


I installed http://vswebessentials.com/

created a file called _reference.js with content

/// <autosync enabled="true" />
/// <reference path="angular.js" />
/// <reference path="underscore.js" />

I learned about it from The Story Behind _references.js

like image 17
Xavier John Avatar answered Oct 11 '22 07:10

Xavier John