-
Notifications
You must be signed in to change notification settings - Fork 16
Home
Microsoft SharePoint 2013 provides a powerfull {@link https://msdn.microsoft.com/en-us/library/dn593591.aspx REST api} that allows to access to all SharePoint elemements (webs, lists, document libraries, users, etc.)
ngSharePoint aims to facilitate this REST access through a set of angular services and directives. This library has been developed to support and facilitate the construction of different real projects on SharePoint.
We strongly recommend learning {@link https://angularjs.org Angular}. If you want to maximize the capabilities of this module, you must know the main components of Angular and how to use them (controllers, directives, services, promises, etc.).
The examples
To use ngSharePoint you'll need to include this module as a dependency of your angular app. In any page of your SharePoint, include a Content Editor WebPart and put the next code inside.
<script src="js/angular.js"></script> <script src="js/ng-sharepoint.min.js"></script> <script> // ...and add 'ngSharePoint' as a dependency var myApp = angular.module('myApp', ['ngSharePoint']); // ... add a main controller myApp.controller('main', ['$scope', 'SharePoint', function($scope, SharePoint) { // Get the current web SharePoint.getCurrentWeb().then(function(web) { // Get the announcements list web.getList('Announcements').then(function(list) { // Get items ... list.getListItems().then(function(items) { $scope.announcements = items; }); }); }); }]); </script>