Angularjs Angular Easy Q-单击ng repeat item时,获取要在我的引导模式内部更新的数据
这段代码准确地在li中重复我的json数据,但当我打开模式时,所有数据都基于第一个索引元素,无论单击ng repeat中的哪个标记。问题可能与确保模态内部的所有内容都是基于其自身的ng repeat li的数据有关,但我不知道如何做到这一点。也许是一个控制器在做一些类似$parent.box的事情,但我很困惑Angularjs Angular Easy Q-单击ng repeat item时,获取要在我的引导模式内部更新的数据,angularjs,twitter-bootstrap,Angularjs,Twitter Bootstrap,这段代码准确地在li中重复我的json数据,但当我打开模式时,所有数据都基于第一个索引元素,无论单击ng repeat中的哪个标记。问题可能与确保模态内部的所有内容都是基于其自身的ng repeat li的数据有关,但我不知道如何做到这一点。也许是一个控制器在做一些类似$parent.box的事情,但我很困惑 <div> <li class="boxes repeat-item" ng-repeat="box in boxes | filter:query | filter:f
<div>
<li class="boxes repeat-item" ng-repeat="box in boxes | filter:query | filter:filterCriteria | orderBy:orderProp | startFrom: currentPage * pageSize | limitTo:pageSize | filter:filterExpr">
<div class="col-xs-12 col-sm-6 col-md-4 work">
<a data-toggle="modal" data-target="#myModal">
<img src="{{box.imageUrl}}"></a>
<h4>{{box.name}}
<p class="pull-right">{{box.completion}}</p>
</h4>
</div>
<div class="modal fade" id="myModal" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<a type="button" class="close" data-dismiss="modal" aria-hidden="true"><i class="fa fa-times fa-lg"></i></a>
<h4 class="modal-title text-center">{{box.name}}</h4>
</div>
<div class="modal-body text-center">
<img src="{{box.imageUrl}}"><br>
</div>
<div class="details">
Height: {{box.height}}<br>
Type: {{box.type}} {{box.units}}<br>
Opening: {{box.completion}}<br>
{{box.snippet}}
</div>
</div>
</div>
</div>
</li>
{{box.name}
{{box.completion}
{{box.name}
高度:{box.Height}}
类型:{{box.Type}{{box.units}}
打开:{box.completion}}
{{box.snippet}
您有多个id为
myModal
的元素。不要那样做。您可以根据box的某些属性创建唯一ID。例如,id=“myModal{{{box.name}}”
(如果name是unqiue)。另外,请确保使用相同的方案设置数据目标。右键单击答案旁边的复选框:)