Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
1
Reply
Angularjs Sharepoint Rest API to showing all columns
Rahul Shinday
Aug 22 2016 11:14 AM
251
Reply
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?
<
div
ng-app
=
"listApp"
>
<
div
id
=
"App1"
ng-controller
=
"controller1"
>
<
h1
>
First List Items
</
h1
>
<
div
ng-repeat
=
"item in items"
>
<
p
>
{{item.Title}}
</
p
>
</
div
>
</
div
>
</
div
>
var
appVar = angular.module(
'listApp'
, []);
appVar.controller(
"controller1"
,
function
($scope){
GetListItems($scope,
"List1"
);
});
function
GetListItems($scope, listName){
$.ajax({
url:
"https://example.com/sites/mysite/_api/web/lists/GetByTitle('"
+listName+
"')/items"
,
method:
"GET"
,
async:
false
,
headers: {
"Accept"
:
"application/json;odata=verbose"
},
success:
function
(data){
$scope.items = data.d.results;
},
error:
function
(sender,args){
console.log(args.get_message());
}
});
}
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
1
)
Next Recommended Forum
how to learn step by step sharepoint
Custom Advance Search page in Sharepoint