AngularJS SharePoint App for getting list data
<!DOCTYPE html>
<html>
<head>
<title>Sharepoint App</title>
</head>
<body ng-app>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.0-beta.11/angular.min.js"></script>
<script src="controller.js"></script>
<script>
var sitedata = sitedata || {};
sitedata.baseSPUrl = 'SiteURL/_api/';
</script>
<h1>WelCome To Angular JS Sharepoint 2013 REST API !!</h1>
<div class="row">
<div ng-controller="employeesController" class="span10">
<table class="table table-condensed table-hover">
<tr>
<th>Title</th>
</tr> <tr ng-repeat="employee in employees">
<td>{{employee.FirstName}}</td>
</tr>
</table>
</div>
</div>
</body>
</html>
//Controller
function employeesController($http, $q, $scope)
{
$scope.employees = [];
var serviceBase = '/Handlers/WebProxy.ashx?url=',
refreshUrlBase = '/home/refreshtoken?returnUrl=',
baseSPUrl = sitedata.baseSPUrl,
baseSPListsUrl = baseSPUrl + 'web/lists/';
var empsPromise = $http.get(serviceBase + encodeURIComponent(baseSPListsUrl + "getByTitle('Employees')/items?$select=ID,FirstName,LastName&$orderby=LastName,FirstName"))
.then(function (data) {
$scope.employees = data.data.d.results;
},
function (error) {
if (error.status === 302) {
}
});
}
Accessing SharePoint list in office 365 using REST API requires the request to be sent from server side for getting the access token. For more information refer the below link Channel9
Resources: