如何为以下Json数据编写重复?

时间:2017-05-06 23:29:47

标签: angularjs

我的数据如下所示。我尝试过键,但它不起作用。 我想在下拉列表中使用ng-repeat显示所有Product_Groups。 我正在使用

ng-repeat="value.Product_Group for (key, value) in pgroup track by $index"

My data is coming like this in console

1 个答案:

答案 0 :(得分:0)

试试这个

  <div ng-repeat="item in pgroup track by $index">
    {{item.Product_Group}}
  </div>

而不是

ng-repeat="value.Product_Group for (key, value) in pgroup track by $index"

<强>样本

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

myApp.controller('MyCtrl', function($scope) {
    $scope.pgroup = [
     {Product_Group: "TrueBeam"},
     {Product_Group: "TrueBeam1"},
     {Product_Group: "TrueBeam2"}
    ];
});
&#13;
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<div ng-app="myApp" ng-controller="MyCtrl">
  <div ng-repeat="item in pgroup track by $index">
    {{item.Product_Group}}
  </div>
</div>
&#13;
&#13;
&#13;