Bootstrap 3 btn-group width使用ng-repeat进行更改

时间:2014-10-15 20:33:40

标签: javascript angularjs twitter-bootstrap-3 radio-button

当我使用静态方式显示所有按钮收音机时,它工作正常(100%宽度),但使用 ng-repeat 的动态问题我有换行符。< / p>

没有ng-repeat: enter image description here

使用ng-repeat: enter image description here

代码段:

<div class="btn-group input-group btn-group-justified" ng-repeat="number in numbers">
    <label class="btn btn-primary" ng-model="radioModel" btn-radio="'{{number}}'">{{number}}</label>
</div>

THE EXAMPLE

1 个答案:

答案 0 :(得分:3)

http://plnkr.co/edit/LFiWKeAdL5FMDrRmpLoP?p=preview

将ng-repeat移至<label>

   <div class="btn-group input-group btn-group-justified">
      <label class="btn btn-primary" ng-model="model.radioModel" btn-radio="{{number}}" ng-repeat="number in numbers" ng-init="model =$parent" name="radio">{{number}}</label>

    </div>