Notes on Using AngularJS in SharePoint 2010
posted by Khoa Quach
on Sep 01, 2014
I got into developing AngularJS solutions on SharePoint earlier and it is just great. With the calls from to the SharePoint REST API returning JSON objects and the built-in deferred object in AngularJS, it made my life so much easier. Most of my projects are on SP 2013, but recently lead a mini-project on SP 2010 involving filtering.
One thing to note are the compatibilities between the different libraries, the SharePoint master page and the IE9 browser is something that I tend to forget. So here are few things to consider:
- SharePoint 2010 Cross browser support both include Internet Explorer 9 and above.
- You can use 1.9.x or 2.0.x but my preferences has been to stick with 1.9.x despite the little performance increase with 2.0.x
- SharePoint master page. For the default master page in SharePoint 2010 (v4.master), the X-UA-Compatible or default mode will be set to IE=8. In order to use Angular, you will need to change it least to IE=9 (you can also use IE=Edge to get the latest versions of the browser)
Finally, your HTML needs to be formatted properly (if you do not want to see weird behaviors happening). In fact, make sure that all required attributes for an HTML tag are defined. If it will still render fine in other browsers, IE9 will just not like it. My most common errors is to forget HREF for the anchor tag or ACTION attribute to form. Not sure if this is related to the Angularjs library or the DOCTYPE html set to Strict on the master page, but as long as you make sure the HTML pass W3C Markup validation service, you will be fine