简体   繁体   English

angularjs ng-repeat没有循环通过模式框

[英]angularjs ng-repeat is not looping through the modal box

Hi everybody so I am building this assignment for a class, and I have reached a wall. 大家好,我正在为课堂准备这项作业,但是我碰壁了。 The ng-repeat is not looping through the modal box. ng-repeat没有循环通过模式框。 It loops through the first item but then stops. 它循环遍历第一项,然后停止。 Any help? 有什么帮助吗? Here is a jsbin to illustrate. 这是一个jsbin来说明。

http://jsbin.com/OZaGipAg/2/edit http://jsbin.com/OZaGipAg/2/edit

Thank you everyone. 谢谢大家。

Looking at the source with Firebug, your code looks to be doing what its supposed to be doing. 使用Firebug查看源代码,您的代码似乎正在执行其应做的事情。 Each list item has a unique picture for the thumbnail and for the modal window in the html. 每个列表项在缩略图和html模态窗口中都有唯一的图片。 This is not a looping issue. 这不是一个循环问题。 The problem is that all of the thumbnails are loading the same modal window (first one). 问题在于所有缩略图都加载相同的模式窗口(第一个)。

Update 更新
I was able to get your thumbnails to load the appropriate image by tying the id generated for each modal window to the $index of the ng-repeat . 通过将为每个模态窗口生成的id绑定到ng-repeat$index ,我能够获取缩略图以加载适当的图像。 Look at the following lines: 查看以下几行:

<div class="modal fade" id="myModal{{$index}}">

<a href='#' data-toggle="modal" data-target="#myModal{{$index}}" >

These two lines are the only place that you used the id. 这两行是您使用ID的唯一位置。 Change lines 24 and 44 to match. 更改第24和44行以匹配。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM