Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/85.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 Ng与ul li的重复在angularjs中没有正确地进行_Javascript_Html_Angularjs - Fatal编程技术网

Javascript Ng与ul li的重复在angularjs中没有正确地进行

Javascript Ng与ul li的重复在angularjs中没有正确地进行,javascript,html,angularjs,Javascript,Html,Angularjs,我使用的是angularjs,这里我需要从数组中获取ul li值,我获取的是值,但不是以正确的方式获取的 <ul> <li class="parent">Category1</li> <li class="child"> <ul> <li>one</li> <li>two</li> <li>three</li> </ul> </li> &l

我使用的是angularjs,这里我需要从数组中获取ul li值,我获取的是值,但不是以正确的方式获取的

<ul>
<li class="parent">Category1</li>
<li class="child">
<ul>
<li>one</li>
<li>two</li>
<li>three</li>
</ul>
</li>

<li class="parent">Category2</li>
<li class="child">
<ul>
<li>four</li>
<li>five</li>
<li>six</li>
</ul>
</li>
</ul>

您可以尝试从数组中获取ul li值:

<ul ng-repeat="(x, y) in items.filter">
<li class="parent"><b>{{x}}</b></li>
<li class="child">
<ul>
<li ng-repeat="p in y.value">{{p}}</li>
</ul>
</li>
</ul>
  • {{x}
    • {{p}
普朗克:
希望有帮助

试图循环查看视图中的
,但它在范围中是
var app = angular.module("myApp", []);
app.controller("myCtrl", function($scope) {
$scope.items = {"filter":{"Category1":{"value":["one","two","three"]},"Category2":{"value":["four","five","six"]}}}
console.log($scope.items.filter);
});
<ul ng-repeat="(x, y) in items.filter">
<li class="parent"><b>{{x}}</b></li>
<li class="child">
<ul>
<li ng-repeat="p in y.value">{{p}}</li>
</ul>
</li>
</ul>