html - 如何在 ng-repeat 中使用 div 模态

标签 html angularjs

我想将循环索引传递给函数 Createprofile()。我想使用 Angular Controller 来执行此操作。

HTML

<li ng-repeat = "proteam in proteams | filter:filtText | filter:filtText1" ng-init="counter">
<p>{{proteam.description}}</p>
    <div class="modal fade" id="collaborateForm" role="dialog" hidden="true" style="overflow: auto;">
         <div class="modal-dialog">
         <!-- Modal content-->
         <div class="modal-content fade in">
              <div class="modal-header">
                  <button type="button" class="close" data-dismiss="modal">&times;</button>
                      <h4 class="modal-title">COLLABORATION FORM</h4>
              </div>
              <div class="modal-body" >
         <!-- Collaborate FORM -->
                   <form  ng-submit="createProfile(counter)" onkeypress="return event.keyCode != 13;">
                        <label>Enter team Name:</label>
                               <input type="text" class="form-control" id="teamName" required="required">
                                     <button type="submit" class="btn btn-primary btn-xs" dismiss="modal" onClick="turnDivOff()">Collaborate</button>
                   </form>
               </div>
              </div>
              </div>
              </div>                                                
                        </li>

最佳答案

试试看

<form  ng-submit="createProfile($index)" onkeypress="return event.keyCode != 13;">

ng-repeat 需要一个数组,所以它有一个与之关联的索引

关于html - 如何在 ng-repeat 中使用 div 模态,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36929198/

相关文章:

javascript - 如何在 Kendo 网格列中显示相关外键数据

angularjs - Angular UI Bootstrap typeahead-append-to

angularjs - 使用 AngularJS 和 Sitecore (SPA) 构建单页应用程序

php - 没有给出时如何在 Laravel 5.1 中使 Request 默认

javascript - Angular : multiple ng-if problems

javascript - Jasmine 和 Angularjs - 为什么 $index 未定义?

javascript - .checked 和 .disable 在 javascript 中不能一起工作

html - 垂直堆叠元素的基线

css - 如何使用 sass 正确避免在 HTML 上嵌入 twitter bootstrap 类名

javascript - 使用 slideToggle 隐藏/显示高级选项,子元素可见