繁体   English   中英

Bootstrap角度模态问题

[英]Bootstrap Angular Modal Issue

对于我的应用程序(使用流星/ urigo在Meteor中编写),我有一个按钮,单击该按钮会显示一个模型。

码:

   <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
     <div class="modal-dialog" role="document">
         <div class="modal-content">

           <div class="modal-body" ng-controller="formCtrl">
             <div ng-repeat="item in meal.items">
                <label>Item {{$index+1}} :
                    <input type="text" class="item" ng-model="item.name"><br>
                </label>
                <label>Calories :
                    <input type="number" class="calories" ng-model="item.cal">
                </label>
                <br>
             </div>
           </div>

           <div class="modal-footer">
              <button ng-click="addItem()" type="button" class="btn btn-primary">+Item</button>
           </div>
       </div>
    </div>
   </div>
 </div>

在第一个“模态主体”类中,我非常有信心自己的代码是正确的,因为它是我以前所做的,而现在我只是实现了引导程序以使它看起来更优雅。

问题出现在“ modal-footer”类中,其中第二个按钮的ng-click应该产生2个输入:

 Item 1 : [______]
 Calories : [_______]

但是由于某种原因,它不会执行该功能。 在过去的8个小时里,我一直在盯着这个试图找到错误,但是我似乎找不到任何错误。

您正在外部调用formCtrl方法。 移动ng-controller上的属性div.modal-content ,或移动button在div内侧保持ng-controller属性

暂无
暂无

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

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