我使用angularJs和Ionic,我想从azure获取数据。
桌子的链接' Winzer'是: https://winetastic.azurewebsites.net/tables/Winzer?ZUMO-API-VERSION=2.0.0
当我打开该链接时,我得到:
[{"id":"b15f5cf0-e576-4b6a-8fec-9e22a9e52630","createdAt":"2017-01-31T22:49:01.016Z","updatedAt":"2017-02-02T07:13:59.587Z","version":"AAAAAAAAHM4=","deleted":false,"Name":"Winzer 1","Streetname":"Straße 1","Address":"Adresse","Phone":null,"Mail":null,"URL":null,"Region":"Region ","Fax":null}]
我想显示属性'姓名'在'离子列表'
我的控制器看起来像这样:
.controller('winzerCtrl', ['$scope', '$stateParams', '$http', 'WineService', function ($scope, $stateParams, $http, WineService) {
$http.get("https://winetastic.azurewebsites.net/tables/Winzer?ZUMO-API-VERSION=2.0.0").then(function (response) { $scope.winzerList = response.data.records; });}])
我的html网站看起来像这样:
<ion-list id="winzer-list9" class="manual-list-fullwidth">
<ion-item ng-repeat="winzer in winzerList | filter:test "class="item-icon-left" id="winzer-list-item33" ui-sref="winetastic.winzerDetails">
<i class="icon ion-android-contact"></i>{{winzer.Name}}</ion-item>
</ion-list>
当我运行项目时,我没有收到错误但列表中没有显示任何数据。 怎么了?
答案 0 :(得分:0)
正如@Kasper Ziemianek所说,你应该替换
$scope.winzerList = response.data.records;
与
$scope.winzerList = response.data;