javascript - AngularJS : Appending the same structure on the click of each item

标签 javascript jquery angularjs angularjs-ng-repeat

我的index.html页面如下:

<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>

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

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

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

这是什么逻辑?

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

enter image description here

请帮忙。谢谢。

最佳答案

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

关于javascript - AngularJS : Appending the same structure on the click of each item,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16141559/

相关文章:

javascript - Elm - 从 js 更新日期输入字段不起作用

javascript - 暂时断开的 Javascript 事件之间状态保留的最佳实践?

javascript - 哪些 JavaScript 主题对于刚接触这门语言的人来说是不能错过的?

javascript - 单击按钮时隐藏/显示隐藏的 div

javascript - 我如何修改此模板以添加可滚动到下一部分的按钮?

javascript - 页面加载时执行 jQuery Popup?

jquery - 如何从括号内的拆分文本中排除 - jQuery

javascript - AngularJS 验证、绑定(bind)等在使用 jQuery 插件(例如 autoNumeric)时不起作用

angularjs - $http.post : Large files do not work

javascript - 访问 Controller 中 html 元素中的 ng-if 属性的值