我正在尝试从我的 angularjs Controller 内部检索超链接列表项。
app.controller('myController', function($scope, $http, $filter) {
method: 'GET',
url: "https://.../_api/web/lists/GetbyTitle('hightlights')/items?$top=1000$select=Product",
header: {"Accept": "application/json;odata=verbose}
}).success(function(data, status, headers, config) {
$scope.products = data.d.results;
console.log($scope.products);
...
但是我在页面上返回的内容如下:
{"__metadata:"{"type":"SP.FieldUrlValue"},"Description":"https://...","Url":"https://..."}
如何获取 url 部分?
最佳答案
我的测试脚本供您引用:
myAngApp.controller('spCustomerController', function ($scope, $http) {
$http({
method: 'GET',
url: _spPageContextInfo.webAbsoluteUrl + "/_api/web/lists/getbytitle('links')/items?$select=URL",
headers: { "Accept": "application/json;odata=verbose" }
}).success(function (data, status, headers, config) {
$scope.customers = data.d.results;
console.log($scope.customers);
$scope.customers.forEach((item,index,array)=>{
console.log(item.URL.Url)
})
}).error(function (data, status, headers, config) {
});
});
关于javascript - 尝试获取超链接列表项 SharePoint 2016 REST API,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61405048/