0

我正在尝试从我的 angularjs 控制器中检索超链接列表项。

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 部分?

4

1 回答 1

2

我的测试脚本供您参考:

    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) {  

            });  
    });
于 2020-04-27T07:24:00.473 回答