Angularjs   发布时间:2022-04-20  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了AngularJS Bootstrap单选按钮组大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在尝试使用此处的教程设置一个单选按钮组:

https://angular-ui.github.io/bootstrap/

所以在我看来我创造了这个:

<div class="form-group">
    <div class="btn-group">
        <label class="btn btn-priMary" ng-model="controller.SELEctedLines[0].forDelivery">For delivery</label>
        <label class="btn btn-priMary" ng-model="!controller.SELEctedLines[0].forDelivery">For collection</label>
    </div>
</div>

我的问题是我无法选择按钮.
在他们的例子中,他们对每个按钮都有不同的布尔值,但是我必须共享布尔值,所以如果布尔值为true,那么按钮“For delivery”应该是活动的,如果值为false则那么“For collection”应该是积极点.

我尝试这样做:

<div class="form-group">
    <div class="btn-group" data-toggle="buttons">
        <label class="btn btn-default" ng-class="active: controller.SELEctedLines[0].forDelivery === true">
            <input type="radio" name="optionsRadios" ng-model="controller.SELEctedLines[0].forDelivery" ng-value="true" ng-change="deliveryController.requestDeliveryDate(controller.order,controller.SELEctedLines)"> For delivery
        </label>
        <label class="btn btn-default" ng-class="active: controller.SELEctedLines[0].forDelivery === false">
            <input type="radio" name="optionsRadios" ng-model="controller.SELEctedLines[0].forDelivery" ng-value="false" ng-change="deliveryController.requestDeliveryDate(controller.order,controller.SELEctedLines)"> For collection
        </label>
    </div>
</div>

但那有同样的问题.
有谁知道如何根据我的价值选择按钮?

解决方法

https://angular-ui.github.io/bootstrap/中给出的例子

<div class="btn-group">
    <label class="btn btn-priMary" ng-model="ra@L_797_2@model" btn-radio="'Left'">Left</label>
    <label class="btn btn-priMary" ng-model="ra@L_797_2@model" btn-radio="'Middle'">Middle</label>
    <label class="btn btn-priMary" ng-model="ra@L_797_2@model" btn-radio="'Right'">Right</label>
</div>

当ra@L_797_2@model =’Left’时,左按钮被选中.

至于您的方案,缺少一些选项.这是工作代码

<div class="btn-group">
    <label class="btn btn-priMary" ng-model="mode" btn-radio="'Delivery'">For delivery</label>
    <label class="btn btn-priMary" ng-model="mode" btn-radio="'Collection'">For collection</label>
</div>

Demo

大佬总结

以上是大佬教程为你收集整理的AngularJS Bootstrap单选按钮组全部内容,希望文章能够帮你解决AngularJS Bootstrap单选按钮组所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。