2016-04-24 5 views
0

Warum gibt ng-repeat keine Ergebnisse aus?Warum gibt mein ng-repeat keine Ergebnisse aus

Die Option Einfügen funktioniert, aber es gibt keine Ausgabe. Bitte helfen Sie mir, das Problem hinzuweisen

<head> 
<script> 
    var syntaxFinder = angular.module('syntaxFinder',[]); 


    syntaxFinder.controller('syntaxCtrl', function($scope, $http){ 
     loaddata(); 
     function loaddata(){ 
      $http.get('https://sheetsu.com/apis/v1.0/471f7802').success(function(data){ 
       $scope.autos = data.result; 
       $scope.refresh = function() { 
        loaddata(); 
       }; 
      }); 
     } 
    }); 

    syntaxFinder.controller('FormCtrl',function($scope,$http){ 

    $scope.SendData = function() { 
     // use $.param jQuery function to serialize data from JSON 
     var data = $.param({ 
      applicatie: $scope.applicatie, 
      locatie: $scope.locatie, 
      beschrijving: $scope.beschrijving, 
      code: $scope.code, 
      inhoud: $scope.inhoud,   
     }); 

     var config = { 
      headers : { 
       'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;' 
      } 
     } 

     $http.post('https://sheetsu.com/apis/v1.0/471f7802', data, config) 
         .success(function (data, status, headers, config) { 
      $scope.PostDataResponse = data; 


     }) 
     .error(function (data, status, header, config) { 
      $scope.ResponseDetails = "Data: " + data + 
      "<hr />status: " + status + 
      "<hr />headers: " + header + 
      "<hr />config: " + config; 
      }); 
     }; 


}); 
</script> 

</head> 

<body ng-controller="syntaxCtrl"> 
    <div class="container"> 
     <div class="row"> 
      <div class="col-md-12"> 
       <h2>Syntax Finder</h2> 

        <div class="form-group"> 
         <label>Zoek op Inhoud: 
          <input class="form-control" type="text" ng-model="search.inhoud" placeholder="Mysql register" /> 
         </label><br/> 
        </div> 

       <table class="table table-striped"> 
        <tr> 
         <th>Applicatie</th> 
         <th>Locatie</th> 
         <th>Beschrijving</th> 
         <th>Code</th> 
         <th>Inhoud</th> 
        </tr> 

        <!--<tr ng-repeat="auto in autos | filter:search:strict | limitTo:10 ">--> 

        <tr ng-repeat="auto in autos | filter:search:strict | orderBy:'applicatie' "> 
         <td>{{auto.applicatie}}</td> 
         <td>{{auto.locatie}}</td> 
         <td>{{auto.beschrijving}}</td> 
         <td>{{auto.code}}</td> 
         <td>{{auto.inhoud}}</td>  
        </tr> 
       </table> 

       <div class="form-group"> 
        <button ng-click="refresh()">Refresh</button> 
       </div> 
      </div> 
     </div> 
    </div> 
</body> 
+0

ist mit Daten $ scope.autos Ist bevölkert werden? – sebenalern

+0

Update-Link der Geige –

+0

Ja sein Empfangen von Daten von einem bleesu.com api, ich verstehe immer noch nicht, was falsch ist mit dem Code – Dann

Antwort

0

Hier ist Ihr Problem gelöst. Aktualisieren Sie Ihre js Code mit diesem

Hier fiddle

var myApp = angular.module('myApp',[]); 

myApp.controller('syntaxCtrl', function($scope, $http){ 
function loaddata(){ 
    $http.get('https://sheetsu.com/apis/v1.0/471f7802').success(function(data){ 
     $scope.autos = data; 
    }); 
} 
$scope.refresh = function() { 
    loaddata(); 
}; 
loaddata(); 

}); 
myApp.controller('FormCtrl',function($scope,$http){ 

$scope.SendData = function() { 
    // use $.param jQuery function to serialize data from JSON 
    var data = $.param({ 
     applicatie: $scope.applicatie, 
     locatie: $scope.locatie, 
     beschrijving: $scope.beschrijving, 
     code: $scope.code, 
     inhoud: $scope.inhoud, 
    }); 

    var config = { 
     headers : { 
      'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;' 
     } 
    } 

    $http.post('https://sheetsu.com/apis/v1.0/471f7802', data, config) 
    .success(function (data, status, headers, config) { 
     $scope.PostDataResponse = data; 
    }) 
    .error(function (data, status, header, config) { 
     $scope.ResponseDetails = "Data: " + data + 
      "<hr />status: " + status + 
      "<hr />headers: " + header + 
      "<hr />config: " + config; 
    }); 
}; 
}); 
+0

Kumpel Sie sind super, ich musste nur den Namen von – Dann

+0

und Sie müssen $ scope.refresh() auch nicht schreiben, wenn Ajax erfolgreich ist –

Verwandte Themen