AngularJS:在点击每个项目时附加相同的结构 [英] AngularJS : Appending the same structure on the click of each item

查看:15
本文介绍了AngularJS:在点击每个项目时附加相同的结构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的 index.html 页面如下所示:

<ul class="下拉菜单"><li ng-repeat="项目中的项目"><a href="#">{{item.name}}</a>

<div id="mainpanel" ng-controller="listCtrl"><div ng-view></div>

对于这个 ng-view,我有 record-list.html 来显示所有的记录,如下所示:

<ul class="设计"><li id="{{record.name}}" ng-repeat="记录在记录中"><div>......</div>

现在我想添加相同的结构(就像每个记录一样)附加在侧面板的每个项目上.

这样做的逻辑是什么?

我最近的用户界面看起来像这样 &我想在每次点击时添加相同的结构,应该附加现有的结构.

请帮忙.谢谢.

解决方案

听起来可能每个记录"都有一组子记录".如果是这种情况,我建议使用 angular 的 ng-switch 指令来有条件地在侧面显示正确(或没有)的子记录集.

My index.html page is like following:

<div id="sidepanel" ng-controller="myCtrl">
<ul class="drop-down">
    <li ng-repeat="item in items">
        <a href="#">{{item.name}}</a>
    </li>
</ul>
</div>
<div id="mainpanel" ng-controller="listCtrl">
    <div ng-view></div>
</div>

For this ng-view I have record-list.html to show all the records which is like following:

<div class="container">
    <ul class="design">
        <li id="{{record.name}}" ng-repeat="record in records">
            <div>......</div>
        </li>
    </ul>
</div>

Now i want to add the same structure (as like each record) append on the click of each item of the side panel.

what is the logic for that ?

My recent UI Looks like this & i want to add the same structure on each click which should be append the existing structure.

Please Help.Thanks.

解决方案

It sounds like perhaps each "record" has a set of children "records." If this is the case, I would recommend using angular's ng-switch directive to conditionally display the correct (or no) set of sub-records on the side.

这篇关于AngularJS:在点击每个项目时附加相同的结构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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