I am trying get list items from an external list using REST API in SharePoint 2013. Below is the external URL:
http://mrutyunjaya/_layouts/15/start.aspx#/Lists/Tool%20Max%20Time/Read%20List.aspx
I am trying to retrieve data from this list using REST API. Below is the code written so far:
var app = angular.module('EatonScanningApp');
app.factory("EatonScanningFactory", ['$http', function($http) {
var EatonScanningFactoryObj = {};
EatonScanningFactoryObj.GetToolMaxTimeList = function () {
return $http({
method: 'GET',
url: "http://psmi-dev3/_api/lists/getbytitle('Tool%20Max%20Time')/items",
headers: { "Accept": "application/json;odata=verbose" }
});
}
}]);
I am trying to access the above rest service in the below code but I am unable to get proper output for the length of the external list which is stored into $scope.list as shown below:
$scope.list = EatonScanningFactory.GetToolMaxTimeList();
console.log($($scope.list.length));
Please help
What I have tried:
var app = angular.module('EatonScanningApp');
app.factory("EatonScanningFactory", ['$http', function($http) {
var EatonScanningFactoryObj = {};
EatonScanningFactoryObj.GetToolMaxTimeList = function () {
return $http({
method: 'GET',
url: "http://psmi-dev3/_api/lists/getbytitle('Tool%20Max%20Time')/items",
headers: { "Accept": "application/json;odata=verbose" }
});
}
}]);