angularjs1如何使用ng-repeat嵌套循环数据生成二级导航?

html

            <ul>
                <li ng-repeat="nav in navs">
                        <a href="">AAA</a>
                    <ul>
                        <li>a1</li>
                    </ul>
                </li>
            </ul>

js

     $http.get("js/nav2.json").success(function(data){
        var ndata = data.return_data.children;
        $scope.navs = ndata;
    })

json

 {
  "return_code": 200,
  "return_data": {
    "menu": null,
    "children": [
      {
        "menu": {"sid": 1000,"menuName": "页面导航","menuUrl": null,"menuImgUrl": null,"menuPSid": null,"menuSort": 0,"menuDesc": null },
        "children": [
          {"menu": {"sid": 10010,"menuName": "AAA","menuUrl": null,"menuImgUrl": null,"menuPSid": 1000,"menuSort": 1,"menuDesc": null },
            "children": []
          },
          {"menu": {"sid": 10020,"menuName": "BBB","menuUrl": null,"menuImgUrl": null,"menuPSid": 1000,"menuSort": 2,"menuDesc": null },
            "children": [
              {"menu": {"sid": 10021, "menuName": "b1","menuUrl": null,"menuImgUrl": null,"menuPSid": 10020,"menuSort": 3,"menuDesc": null },
                "children": []
              }
            ]
          }
        ]
      }
    ]
  }
}

1个回答

  • AAA
    • a1
                </li>
            </ul>
    
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问