ul
및 li
을 사용하는 메뉴가 있습니다. Angular 및 JSON 객체로 표시하고 싶습니다.Angles Js로 n 레이어 중첩 json 객체를 표시하는 방법은 무엇입니까?
ng-repeat
으로 시도하지만 내 개체에 20 개의 레이어 중첩 개체가 있거나 다른 레이어에 중첩 된 자식 레이어가있는 경우 내 문제는 무엇입니까?
HTML
<ul>
<li ng-repeat="item in model">
{{item.text}}
</li>
</ul>
코드 내 JSON 객체는 다음과 같습니다
이var model = [
{ text: "one", link: "#" },
{ text: "tow", link: "#" },
{
text: "three",
link: "#",
children: [
{ text: "four", link: "#" },
{ text: "five", link: "#", children: [{text:"nine", link:"#"}] },
{ text: "six", link: "#" }
]
}];
$scope.model = model;
가능한 복제본 http://stackoverflow.com/questions/34737227/using-ng-repeat-how-to-retrieve-data-from-nested-json-object?rq=1 –
@steady_daddy ur 답변이 잘못되었습니다. 2 층만 지원 – Motion