对于我的应用程序,(我正在使用角流星/ urigo在Meteor中编写)我有一个按钮,单击时出现一个模型。Bootstrap Angular Modal问题
代码:
<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>
在第一个“模体”课,我非常有信心,我的代码是正确的,因为它是我在做之前,现在我只是执行引导,使它看起来更优雅。
的问题发生在“模态躯”级为第二个按钮,其中的NG-单击应该产生2个输入:
Item 1 : [______]
Calories : [_______]
但由于某些原因,它不打算去了功能。我一直盯着过去8小时试图找到一个错误,但我似乎无法找到任何。
'addItem'是“formCtrl”的一种方法吗? – mguimard
是的,addItem是formCtrl的一种方法 – halapgos1
那么它应该在保存'ng-controller'属性的div内 – mguimard