我正在使用 ng-bootstrap ngbRadioGroup
如下:
<div>
<label>Deductible:</label>
<div class="radio-group" [(ngModel)]="transaction.isDeductible" ngbRadioGroup name="isDeductible">
<label class="btn btn-secondary"><input type="radio" [value]="true">Yes</label>
<label class="btn btn-secondary"><input type="radio" [value]="false">No</label>
</div>
</div>
不幸的是,选择其中一个选项不会设置 transaction.isDeductible
属性。
可能是什么问题?
提前感谢您的任何见解,如果我可以提供其他相关信息,请告诉我:)
编辑:
如果再有两个 RadioGroup,这可能毫无值(value),我在这里提供了最简单的一个
最佳答案
对我来说,从 angular-cli.json
脚本中删除 ../node_modules/bootstrap/dist/js/bootstrap.js
行包括修复问题。显然,如果您需要 Bootstrap JavaScript,这并不适合所有人!
所以 ng-bootstrap 和 Bootstrap JavaScript 之间肯定存在冲突。我现在没有时间研究它,也许其他人可以?如果我需要使用它,我可能会回来使用它。
关于javascript - 为什么 radio 组的 [(ngModel)] 不绑定(bind)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41211439/