Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/23.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
Javascript 使用数组重复_Javascript_Angularjs - Fatal编程技术网

Javascript 使用数组重复

Javascript 使用数组重复,javascript,angularjs,Javascript,Angularjs,我有这种类型的对象。我将其分配到控制器中的vm.employess变量中。现在我想在HTML区域重复这一点。我设法做到了这一点: { "employees" : [ { "name" : "XXX", "id" : "1", "Salary" : [ { "Month" : "XXXX", "Amount" : "XXXX",

我有这种类型的对象。我将其分配到控制器中的
vm.employess
变量中。现在我想在HTML区域重复这一点。我设法做到了这一点:

{
"employees" : [ 
    {
        "name" : "XXX",
        "id" : "1",
        "Salary" : [ 
            {
                "Month" : "XXXX",
                "Amount" : "XXXX",
            }, 
            {
                "Month" : "XXXX",
                "Amount" : "XXXX",
            }, 
            {
                "Month" : "XXXX",
                "Amount" : "XXXX",
            }
        ]
    }, 
    {
        "name" : "YYY",
        "id" : "2",
        "Salary" : [ 
            {
                "Month" : "YYYY",
                "Amount" : "YYYY",
            }, 
            {
                "Month" : "YYYY",
                "Amount" : "YYYY",
            }, 
            {
                "Month" : "YYYY",
                "Amount" : "YYYY",
            }
        ]
    }
],
}

{{i.id}
{{i.name}

我也想重复工资,但我没能做到。有人能帮我吗

由于嵌套了json,因此需要使用嵌套的
ng repeat

 <div ng-repeat="i in vm.employees">
            {{i.id}}
            {{i.name}}
   </div>

{{i.id}
{{i.name}
{{sal.Month}
{{sal.Amount}}

@Janukasamaranyake,很高兴看到:)
<div ng-repeat="i in vm.employees">
            {{i.id}}
            {{i.name}}
    <div ng-repeat="sal in i.Salary">
         {{sal.Month}}
         {{sal.Amount}}
    </div>
</div>