# Need Help: Data via $http

**URL:** <https://forum.ionicframework.com/t/need-help-data-via-http/34601>\
**Category:** ionic-v1\
**Created:** [October 14, 2015, 11:29am UTC](https://forum.ionicframework.com/t/need-help-data-via-http/34601 "2015-10-14T11:29:47Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Giregar](https://avatars.discourse-cdn.com/v4/letter/g/c77e96/32.png) [@Giregar](https://forum.ionicframework.com/u/Giregar)\
**Post date:** [October 14, 2015, 11:29am UTC](https://forum.ionicframework.com/t/need-help-data-via-http/34601/1 "2015-10-14T11:29:48Z")

</div>

Hello,  
I try to display some data via $http in my app. A php file is receiving the data from the database encodes it to JSON. But at the end, my ion-item element in the **tab-search.html** is empty. But receiving the data was succesful. I can see it in the console of my browser. Hope you can understand my problem.

Here’s my code.

**tab-search.html**

```
   <ion-content class="has-subheader">
    <ion-list>
      <ion-item ng-href="#" ng-repeat="angebot in angebote">
        <img ng-src="{{ angebot.titelbildUrl }}" class="full-width">
        <h2>{{ angebot.titel }}</h2>
        <p>{{ angebot.beschreibung }}</p>
      </ion-item>
    </ion-list>  
  </ion-content>

```

**controller.js**

```
    var app = angular.module('starter');

    app.controller('angeboteCtrl', function($scope, $http){

    load();

    function load() {
	  $http.get('http://www.siregar.net/testing/eventAppBackend/getAngebote.php').success(function(response) {
	    console.log(response);
	    $scope.angebote = response.data;
	  });
	};

```

**app.js**

```
var app = angular.module('starter', ['ionic'])

app.run(function($ionicPlatform) {
  $ionicPlatform.ready(function() {
    // Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
    // for form inputs)
    if (window.cordova && window.cordova.plugins && window.cordova.plugins.Keyboard) {
      cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
      cordova.plugins.Keyboard.disableScroll(true);

    }
    if (window.StatusBar) {
      // org.apache.cordova.statusbar required
      StatusBar.styleLightContent();
    }
  });
})

app.config(function($stateProvider, $urlRouterProvider) {

  // Ionic uses AngularUI Router which uses the concept of states
  // Learn more here: https://github.com/angular-ui/ui-router
  // Set up the various states which the app can be in.
  // Each state's controller can be found in controllers.js
  $stateProvider

  // setup an abstract state for the tabs directive
    .state('tab', {
    url: '/tab',
    abstract: true,
    templateUrl: 'templates/tabs.html'
  })

  // Each tab has its own nav history stack:

  .state('tab.search', {
      url: '/search',
      views: {
        'tab-search': {
          templateUrl: 'templates/tab-search.html',
          controller: 'angeboteCtrl'
        }
      }
    })
    .state('tab.details', {
      url: '/search/:angebotId',
      views: {
        'tab-details': {
          templateUrl: 'templates/tab-details.html',
          controller: 'angeboteCtrl'
        }
      }
    })

  .state('tab.profile', {
    url: '/profile',
    views: {
      'tab-profile': {
        templateUrl: 'templates/tab-profile.html'
      }
    }
  });

  // if none of the above states are matched, use this as the fallback
  $urlRouterProvider.otherwise('/tab/search');

});
```

---

<div class="post-metadata">

**Author:** ![motiurion](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/motiurion/32/81360_2.png) [@motiurion](https://forum.ionicframework.com/u/motiurion)\
**Post date:** [October 14, 2015, 2:15pm UTC](https://forum.ionicframework.com/t/need-help-data-via-http/34601/2 "2015-10-14T14:15:57Z")

</div>

You can try by this: In controller outside the load function you have to define $scope.angebote variable as

```
$scope.angebote = {};
or $scope.angebote = [];
```
