2016-09-30 80 views
0

我有顯示的角... 查詢記錄這樣的問題.. 角控制器如何角JS顯示資源對象

 angular.module('MyApp') 
       .controller('CountriesCtrl', function ($scope, $rootScope, $routeParams, Countries) { 




      Countries.query({}, function (countries) { 
    //Countries.get() return Expected response to contain an object but got an array so i use countries.query.... 

          $scope.countries = countries; 
          console.log(countries); 


         }); 
        }) 

返回 enter image description here

..使用返回的數據我如何使用ng-repeat顯示角度...

謝謝

回答

1

使用NG-重複陣列上:

<div ng-repeat="country in countries"> 
    <span>{{country.name}}</span> 
</div> 

我建議無論如何都要遵循一些好的教程和文檔:這是非常基本的東西。關於ng-repeat的文檔可以發現here