List with array-data from database


#1

Hey guys,

i get an array like that from my database request.

Object
groups: Array[7]
0: Object
add_date: "02.04.2015"
categorie: "Outdoor"
gm_status: 1
group_ID: 9
groupadmin_ID: 1
groupadmin_forename: "André"
groupadmin_surname: "Driesel"
titel: "TEST3"
year: 2015
__proto__: Object
1: Object
2: Object
3: Object ...

For testing i want to display that like a normal list and so i used the chat-example from the ionic standard.
Here the code from the tab-groups.html:

<ion-view view-title="Gruppen">
  <ion-content>
    <ion-list>
      <ion-item class="item-remove-animate item-avatar item-icon-right" ng-repeat="group in groups" type="item-text-wrap" href="#/tab/groups/{{group.id}}">
        <h2>{{group.group_ID}}</h2>
        <p>{{group.year}} {{group.categorie}} {{group.titel}}</p>
        <i class="icon ion-chevron-right icon-accessory"></i>
        <ion-option-button class="button-assertive" >
          Delete
        </ion-option-button>
      </ion-item>
    </ion-list>
  </ion-content>
</ion-view>

Do i have to build an factory for that? Actually i load this array via the controller, like that:

.controller('GroupsCtrl', function($scope, $http) {
 loadGroups(); // Load all available tasks
 function loadGroups(){
  $http.get("http://localhost/testapp/www/php/load_Groups.php").success(function(data){
  console.log("request successfull")
  $scope.Groups = data;
  console.log(data);
  });
 };
})