I needed something like that once, to do a portion of the data loading on the page without a PostBack request, and the data should have been taken from the Sharepoint list. Turning to the great Google came to the conclusion that I have only one option: REST Interface.<SharePoint:ScriptLink ID="ScriptLinkAngular" runat="server" Name="SharePointProject/js/angular/angular.js" Localizable="false"/> <SharePoint:ScriptLink ID="ScriptLinkApp" runat="server" Name="SharePointProject/js/app.js" Localizable="false"/> <div ng-app="testApp"> <div ng-controller="ListCtrl"> <div ng-repeat="item in JsonItems.items" style="margin-top: 10px;"> <pre> CustomTest: <b>{{item.CustomTest}}</b> <br/> CustomNumber: <b>{{item.CustomNumber}}</b></pre> </div> <!-- --> <div ng-show="JsonItems.showError" class="alert alert-danger" >{{JsonItems.error}}</div> <!-- --> <div ng-show="JsonItems.busy" class="alert alert-info" >Loading data...</div> <!-- --> <div ng-hide="JsonItems.busy" class="alert alert-success" ng-click="JsonItems.nextPage()" > Get more... </div> </div> </div> var testApp = angular.module('testApp', []); testApp.controller('ListCtrl', ListCtrl); function ListCtrl($scope, $http, Items) { $scope.JsonItems= new Items(); $scope.JsonItems.nextPage(); } testApp.factory('Items', function($http) { var Items = function() { this.items = []; this.busy = false; this.after = 0; this.count=25; this.showError= function () { return this.error.length>0}; this.error=""; }; Items.prototype.nextPage = function() { if (this.busy) return; this.busy = true; var url = "http://{siteName}/_vti_bin/ListData.svc/Test?$skip=" + this.after + "&$top="+this.count +"&$orderby=CustomNumber&$select=CustomNumber,CustomTest"; $http({method: 'GET', url: url }).success(function(data) { var items = data.d; if (items.length > 0){ for (var i = 0; i < items.length; i++) { this.items.push(items[i]); } else { this.error = "No more data" } this.after += this.count; this.busy = false; } }.bind(this)). error(function(data, status) { this.error = "Error: " + data; this.busy = false; }.bind(this)); }; return Items; }); var url = "http://{siteName}/_vti_bin/ListData.svc/Test?$skip=" + this.after + "&$top="+this.count +"&$orderby=CustomNumber&$select=CustomNumber,CustomTest"; var items = data.d; var items = data.d.results; Source: https://habr.com/ru/post/200936/
All Articles