Rahul Shinday

Rahul Shinday

  • NA
  • 20
  • 11.7k

Angularjs Sharepoint Rest API to showing all columns

Aug 22 2016 11:14 AM
I have created a very basic controller to pull data from a SharePoint list, but it only pulls the base Title and created column. It doesn't pull any columns I have created, which are the ones I require. Is there a setting in SP itself to state it is available for the API?
 
  1. <div ng-app="listApp">      
  2.     <div id="App1" ng-controller="controller1">      
  3.         <h1>First List Items</h1>      
  4.         <div ng-repeat="item in items">      
  5.             <p>{{item.Title}}</p>      
  6.         </div>      
  7.     </div>            
  8. </div>   
 
  1. var appVar = angular.module('listApp', []);    
  2.   
  3. appVar.controller("controller1"function($scope){      
  4.     GetListItems($scope, "List1");      
  5. });    
  6.   
  7. function GetListItems($scope, listName){      
  8.     $.ajax({      
  9.         url: "https://example.com/sites/mysite/_api/web/lists/GetByTitle('"+listName+"')/items",      
  10.         method: "GET",      
  11.         async: false,      
  12.         headers: { "Accept""application/json;odata=verbose" },      
  13.         success: function(data){      
  14.             $scope.items = data.d.results;      
  15.         },      
  16.         error: function(sender,args){      
  17.             console.log(args.get_message());      
  18.         }      
  19.     });      
  20. }      
 

Answers (1)