Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Arrays 使用ng repeat获取多维数值数组_Arrays_Angularjs_Multidimensional Array - Fatal编程技术网

Arrays 使用ng repeat获取多维数值数组

Arrays 使用ng repeat获取多维数值数组,arrays,angularjs,multidimensional-array,Arrays,Angularjs,Multidimensional Array,我使用$http.get从json文件获取数组,如下所示: {user\u id:{script\u id,cron\u格式…} {"1":{"1":"*\/3 * * * *","2":"*\/6 * * * *","3":"*\/3 * * * *","4":"* * * * *"}, "2":{"1":"*\/3 * * * *","2":"*\/2 * * * *","3":"*\/Al test","4":"* * * * *"}, "3":{"1":"*\/3 * * * *","2

我使用$http.get从json文件获取数组,如下所示: {user\u id:{script\u id,cron\u格式…}

{"1":{"1":"*\/3 * * * *","2":"*\/6 * * * *","3":"*\/3 * * * *","4":"* * * * *"},
"2":{"1":"*\/3 * * * *","2":"*\/2 * * * *","3":"*\/Al test","4":"* * * * *"},
"3":{"1":"*\/3 * * * *","2":"*\/6 * * * *","3":"*\/3 * * * *","4":"12 "}}
我试图将所有值放入表中的三列,但我不知道如何获取所有值: 最佳尝试仅获得脚本id和cron格式:

 <table class="table table-bordered table-hover">
        <thead>
            <td>user name</td>
            <td>script id</td>
            <td>cron format</td>
        </thead>
        <tbody ng-repeat="row in data">
            <tr ng-repeat="(script_id, cron_format) in row">
                <td>{{user_id}}</td>
                <td>{{script_id}}</td>
                <td>{{cron_format}}</td>
            </tr>
        </tbody>
    </table>

用户名
脚本id
cron格式
{{user_id}}
{{script_id}}
{{cron_format}}

试图在数据和行中执行相同的操作,但不起作用,因为我有行变量……请提供任何解决方案?

您非常接近-您的
tbody
元素中的
ng repeat
指令应该如下所示:

<tbody ng-repeat="(user_id, row) in data">


这将把对象中的顶级键映射到
user\u id
,从您的问题来看,这就是我认为您想要的。

您能否举例说明示例json数据的输出行是什么……这将帮助我们了解您如何尝试映射此数据。