1
  • we're testing our custom webparts using angular.js
  • in Sharepoin 2013 it works but not within our SP 2010 Environment
  • the needed angular and jquery library are linked correctly

As test code in the webpart we just use

<script src="../../_layouts/Angular/angular.js"></script>
<script src="../../_layouts/Angular/jquery-1.9.1.min.js"></script>
<div>
      <input type="text" ng-model="search">
     <p>you're searching for: {{search}}</p>
</div>

We as well tried to Change the browser compatibiliy advised in http://niftit.com/angularjs-in-sharepoint-2010/ but showing the page with the webpart angular is not bound (showing "{{search}}" - in any browser.

What could be the reason that the active script is not executing?

3

I had the same experience when migrated our SP2013-based AngularJS solutions to SP2010. The problem was in our case a kind of timing issue.

The solution was to introduce a 1-2 seconds of delay in the controller before calling the methods of our SharePoint service:

setTimeout(function () { 
    $scope.getContacts($scope, mySharePointService); 
}, 1000);

Further steps that may help: Instead of <div ng-app="myApp"> use <div ng-app="myApp" id="ng-app">

Disable the $sce service of AngularJS in the application if the document is displayed in quirks mode. We can achieve that via the config method of the application:

myApp.config(function ($sceProvider) { 
    // Completely disable SCE to support IE7 (quirks mode in SharePoint 2007 / 2010). 
    // SCRIPT5022: [$sce:iequirks] http://errors.angularjs.org/1.3.0-beta.6/$sce/iequirks 
    if ((document.documentMode == 5) || (document.documentMode == 7)) { 
        // or: if (document.documentMode < 8) { 
        $sceProvider.enabled(false); 
    } 
});

See details here.

  • Hi All, what are the steps to implement Angular 2 in the SharePoint 2010? – RajeshSharepointGeek Feb 18 '18 at 0:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.