如何在Angular中创建层次树

发布于 2025-02-04 05:34:40 字数 493 浏览 2 评论 0原文

我有列表的要求,当单击每个列表时,它应该加载API,并且需要绑定单击该列表的另一个列表。因此,这应该发生在所有列表中。在Angular中完成此分层树列表的最佳方法是什么?

示例:

  • List1
    • 儿童1
      • ChildChild1
        • ChildChildChild1
          • ChildChildChildChild1
        • ChildChildChild2
      • ChildChild2
    • child2
    • child3
  • list3
  • list3
  • list4,

因此list1的同一列表中的所有列表2,list3和list4等列表都应发生。仅当我们单击父列表时,儿童列表才应加载。欣赏Stackblitz示例。谢谢

I have the requirement that is list and when clicking each list it should load API and need to bind another list inside the which one is clicked. So this should happen for all list. What is the best way to do this hierarchal tree list in angular.

Example :

  • list1
    • child1
      • childchild1
        • childchildchild1
          • childchildchildchild1
        • childchildchild2
      • childchild2
    • child2
    • child3
  • list2
  • list3
  • list4

So the same of list1 should happen for all list like list2, list3 and list4. The child list should load only when we clicking the parent list. Appreciate with stackBlitz example. Thank you

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文