具有动态值的离子视图

时间:2016-01-06 08:31:59

标签: angularjs ionic-framework ionic

我是Ionic / Angular堆栈的新手,我试图根据以下JSON数据创建手风琴列表。

{  
   "parent":{  
      "url":"parent.html",
      "name":"Parent",
      "children":[  
         {  
            "type":"folder",
            "name":"Folder 1",
            "url":"folder1.html",
            "children":[  
               {  
                  "type":"file",
                  "name":"File 1",
                  "url":"folder1-file1.html",
                  "children":[  

                  ]
               },
               {  
                  "type":"file",
                  "name":"File 2",
                  "url":"folder1-file2.html",
                  "children":[  

                  ]
               },
               {  
                  "type":"file",
                  "name":"File 2",
                  "url":"folder1-file3.html",
                  "children":[  

                  ]
               }
            ]
         },
         {  
            "type":"folder",
            "name":"Folder 2",
            "url":"folder2.html",
            "children":[  

            ]
         },
         {  
            "type":"folder",
            "name":"Folder 3",
            "url":"folder3.html",
            "children":[  
               {  
                  "type":"file",
                  "name":"Folder3 File1",
                  "url":"folder3-file1",
                  "children":[  

                  ]
               },
               {  
                  "type":"folder",
                  "name":"Folder3 Folder1",
                  "url":"folder3-file1",
                  "children":[  
                     {  
                        "type":"folder",
                        "name":"Folder3 Folder1 Folder1",
                        "url":"folder3-folder1-folder1",
                        "children":[  
                           {  
                              "type":"file",
                              "name":"Folder3 Folder1 Folder1 File1",
                              "url":"folder3-folder1-folder1-file1",
                              "children":[  

                              ]
                           },
                           {  
                              "type":"file",
                              "name":"Folder3 Folder1 Folder1 File2",
                              "url":"folder3-folder1-folder1-file2",
                              "children":[  

                              ]
                           }
                        ]
                     }
                  ]
               }
            ]
         }
      ]
   }
}

以下是我创建的示例http://codepen.io/udhayakumar/pen/BjWwPm,现在问题是当深度项2有子项时(codepen示例中带有' +'符号的项目),我必须加载深度为2的新视图(即具有' +'的项目)和深度为3的项目作为其子项。

问题是如何在有更多子项的情况下再次使用新值加载相同的视图等等。

如何实现这个?对此的任何帮助将不胜感激。

0 个答案:

没有答案