是否可以使用 Angular 制作树视图? [英] Is it possible to make a Tree View with Angular?

查看:27
本文介绍了是否可以使用 Angular 制作树视图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望在网络应用程序中以树结构显示数据.我希望使用 Angular 来完成这项任务.

I'm looking to display data in a tree structure in a web app. I was hoping to use Angular for this task.

看起来 ng-repeat 将允许我遍历节点列表,但是当给定节点的深度增加时,我如何进行嵌套?

Looks like ng-repeat will allow me to iterate through a list of nodes, but how can I then do nesting when a given node's depth increases?

我尝试了 以下代码,但是 HTML 的自动转义阻止了它的工作.另外,结束 ul 标签位置错误.

I tried the following code, but the auto-escaping of the HTML is preventing this from working. Plus, the end ul tag is in the wrong place.

我很确定我处理这个问题的方式完全错误.

I'm pretty sure that I'm going about this problem entirely the wrong way.

有什么想法吗?

推荐答案

看看这个小提琴

原文:http://jsfiddle.net/brendanowen/uXbn6/8/

更新:http://jsfiddle.net/animaxf/uXbn6/4779/

这应该能让您很好地了解如何使用 angular 显示树状结构.有点像html中的递归!

This should give you a good idea of how to display a tree like structure using angular. It is kind of using recursion in html!

这篇关于是否可以使用 Angular 制作树视图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆