Ronald Peroutka Ronald Peroutka - 4 years ago 113
HTTP Question

AngularJS Http-Service get no Data

I work with angularJs and Ionic and I want to get Data from azure.

The link to the table 'Winzer' is:
https://winetastic.azurewebsites.net/tables/Winzer?ZUMO-API-VERSION=2.0.0

When I open that link I get:

[{"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}]


I want to show the attribute 'Name' in an 'ion-list'

my controller looks like this:

.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; });}])


and my html site looks like this:

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


When I run the Project, i don't get an error but no data were shown in the list.
Whats wrong?

Answer Source

As @Kasper Ziemianek said, you should replace

$scope.winzerList = response.data.records; 

with

$scope.winzerList = response.data;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download