ng-bind和ng-model不能与同一变量

时间:2016-07-08 22:41:36

标签: javascript angularjs

以下是我的HTML

<uib-accordion-group class="panel-product" data-ng-repeat="row in vm.transaction.data">
                <span uib-accordion-heading>
                    <span>{{row.quantity}}</span> x <span data-ng-bind="row.name"></span><span class="pull-right" data-ng-bind="row.total() | currency"></span>
                </span>
                <div class="row">
                    <div class="form-group col-md-4">
                        <label class="control-label field-label">Price: </label>
                        <input type="number" class="form-control text-right" data-ng-minlength="3" data-ng-model="row.salePrice" data-ng-required="true" />
                    </div>
                    <div class="form-group col-md-4">
                        <label class="control-label field-label">Quantity: </label>
                        <input type="number" class="form-control text-center" data-ng-minlength="3" data-ng-model="row.quantity" data-ng-required="true" />
                    </div>
                    <div class="form-group col-md-4">
                        <label class="control-label field-label">Discount <small>%</small>: </label>
                        <input type="number" class="form-control text-center" data-ng-minlength="3" data-ng-model="row.discounts[0].value" data-ng-required="true" />
                    </div>
                </div>
            </uib-accordion-group>

你看到row.quantity变量正在ng-model和ng-bind中使用,它可以在ng-model中正常工作,我可以看到输入字段中的值,但是数量的值没有显示出来在ng-bind范围内以及row.total()函数也无效。

0 个答案:

没有答案