search

Home  >  Q&A  >  body text

angular.js - 关于angularjs的ng-repeat 数组问题

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>

但是出现了问题如下图 ,请问各位大神这个问题如何解决呢:(

黄舟黄舟2744 days ago410

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