AngularJS UI 引导程序“btn-radio"指令不起作用 [英] AngularJS UI Bootstrap "btn-radio" directive doesn't work
问题描述
谁能解释为什么前两个按钮组起作用,而第三个不起作用?
<button ng-repeat="公司中的公司"类=btn"ng-model="radioModel.id"btn-radio="company.id">{{公司名}}按钮><div class="btn-group"><button class="btn btn-two"ng-model="radioModel.id"btn-radio="2">二按钮><button class="btn btn-two"ng-model="radioModel.id"btn-radio="3">三按钮>
<div class="btn-group"><button ng-repeat="公司中的公司"class="btn btn-{{ company.name }}"ng-model="radioModel.id"btn-radio="company.id">{{公司名}}按钮>
$scope.companies = [ { id: 2, name: "two"}, {id: 3, name: "three"} ];$scope.radioModel = { id: 3 };
此示例使用 AngularUI Bootstrap 0.5.0.如果我将其更改为 0.3.0,一切都会按预期进行.
使用 ng-class
.class
中的字符串插值很时髦.
ng-class="'btn btn-' + company.name"
Could anyone explain why the first two button groups work, but the third one doesn't?
<div class="btn-group">
<button ng-repeat="company in companies"
class="btn"
ng-model="radioModel.id"
btn-radio="company.id">
{{company.name}}
</button>
</div>
<div class="btn-group">
<button class="btn btn-two"
ng-model="radioModel.id"
btn-radio="2">
two
</button>
<button class="btn btn-two"
ng-model="radioModel.id"
btn-radio="3">
three
</button>
</div>
<div class="btn-group">
<button ng-repeat="company in companies"
class="btn btn-{{ company.name }}"
ng-model="radioModel.id"
btn-radio="company.id">
{{company.name}}
</button>
</div>
$scope.companies = [ { id: 2, name: "two"}, {id: 3, name: "three"} ];
$scope.radioModel = { id: 3 };
This example uses AngularUI Bootstrap 0.5.0. If I change it to 0.3.0, everything works as expected.
Use ng-class
. The string interpolation in class
is funky.
ng-class="'btn btn-' + company.name"
这篇关于AngularJS UI 引导程序“btn-radio"指令不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!