I'm working on coupons project, and i want to display to the client all the coupons that available to purchase. When i click on the button that call to the function "getAllCoupons()" it works and it returns the results in JSON, but when i want to Insert the results into the table with ng-repeat it displays only if the function returns more than one coupon, if there is only one coupon the ng-repeat don't displays nothing.
This is my controller
  angular.module('companyApp', []);
  angular.module('companyApp').controller('companyController',
  function($rootScope, $scope, $http) {
  $scope.getAllCoupons = function() {
                $http.get("rest/CompanyService/getAllCoupon").success(
                        function(response) {
                            $scope.allCoupons = response.coupon;
                        });
This is my HTML
<div ng-app="companyApp" ng-controller="companyController">
<button class="tablinks" ng-click="getAllCoupons()" id="getAll">Get all coupons</button>
<table align="center"  class="table table-striped" style="width: 900px;">
            <thead>
                <tr>
                    <th> Id </th>
                    <th>Coupon Title</th>
                    <th>Amount</th>
                      <th>Start Date</th>
                        <th>End Date</th>
                          <th>Price</th>
                           <th>Message</th>
                            <th>Coupon Type</th>
                </tr>
            </thead>
            <tbody>
                <tr ng-repeat="x in allCoupons">
                    <td>{{ x.id }}</td>
                    <td>{{ x.title }}</td>
                     <td>{{ x.amount }}</td>
                      <td>{{ x.startDate }}</td>
                       <td>{{ x.endDate }}</td>
                        <td>{{ x.price }}</td>
                         <td>{{ x.message }}</td>
                          <td>{{ x.type }}</td>
                </tr>
            </tbody>
        </table>
    </div>
But if i write it without the ng-repeat it works and i get it in JSON:
 <div ng-app="companyApp" ng-controller="companyController">
 <button class="tablinks" ng-click="getAllCoupons()" id="getAll">Get all coupons</button>
  {{ allCoupons }}
  </div>
The response for single coupon is:
  {"coupon":{"amount":"149","endDate":"04/12/2020","id":"6","message":"only big sizes","price":"79.9","startDate":"07/08/2014","title":"pajamas","type":"FASHION"}}
And the response for multiple coupons is:
{"coupon":[{"amount":"60","endDate":"05/09/2020","id":"5","message":"warranty for 1 year","price":"200.99","startDate":"20/02/2014","title":"sunglasses","type":"FASHION"},{"amount":"149","endDate":"04/12/2020","id":"6","message":"only big sizes","price":"79.9","startDate":"07/08/2014","title":"pajamas","type":"FASHION"}]}  
Thanks for help :)
 
     
    