我的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>
现在我想添加相同的结构(就像每个记录一样)附加在侧面板每个项目的单击上。
这是什么逻辑?
我最近的用户界面看起来像这样,我想在每次点击时添加相同的结构,该结构应该附加到现有的结构。
请帮忙。谢谢。
最佳答案
听起来也许每个“记录”都有一组子“记录”。如果是这种情况,我建议使用 Angular 的 ng-switch 指令有条件地在侧面显示正确(或没有)的子记录集。
关于javascript - AngularJS : Appending the same structure on the click of each item,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16141559/