16
我在動態生成angular的ui.bootstrap中的無線電模型選項時遇到問題。我以爲我可以簡單地NG-重複一個數組,使用它是像這樣的BTN-radio屬性內容:Angular UI.Bootstrap的單選按鈕與ng-repeat一樣奇怪
//in the controller
$scope.radioModel = undefined;
$scope.radioModelButtons = ["a", "b", "c"];
//in the html
<div class="btn-group" >
<button ng-repeat="value in radioModelButtons"
class="btn" type="button" ng-model="radioModel"
btn-radio="'{{value}}'">
{{value}}
</button>
</div>
我使用的角度1.1.4和0.3.0 ui.bootstrap。
Here is a jsfiddle of my efforts,正如您所見,單選按鈕獨立工作,不會影響radioModel變量。
謝謝!
非常感謝:D我現在在閱讀「範圍原型繼承的細微差別」 – 2013-05-08 15:36:04