search

Home  >  Q&A  >  body text

angular.js - About the ng-repeat array issue of angularjs

angular.module("myApp",["myDirective"])
    .controller("myController",["$scope",function($scope){
        $scope.data={
            "one":["状态1","状态2","状态3","状态4"],
            "one1":["状态1","状态2","状态3","状态4"],
        };
        $scope.choice="";
        $scope.choice1="";
        $scope.pane=[
            {'title':'本月个人排行','text':'1','white':true,'data':'["名字","销售额","排名"]'},
            {'title':"本月门店排行",'text':'1','white':false,'data':'["名字","销售额","排名"]'},
            {'title':"上月个人排行",'text':'1','white':false,'data':'["名字","销售额","排名"]'},
            {'title':"上月门店排行",'text':'1','white':false,'data':'["名字","销售额","排名"]'}
        ];

    }]);
  <table>
            <tr ng-repeat="j in pane">
                <td ng-repeat="x in j.data track by $index">{{x}}</td>
            </tr>
        </table>

But there is a problem as shown below. Could you please tell me how to solve this problem: (

黄舟黄舟2868 days ago453

reply all(1)I'll reply

  • 黄舟

    黄舟2017-05-15 17:05:51

    {'title':'Personal ranking this month','text':'1','white':true,'data':'["name","sales","ranking"]'},

    j.data is a string. .

    {'title':'Personal ranking this month','text':'1','white':true,'data':["name","sales","ranking"]},
    Try this way Try

    reply
    0
  • Cancelreply