首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在SweetAlert中用AngularJS获取单选按钮值

问如何在SweetAlert中用AngularJS获取单选按钮值
EN

Stack Overflow用户
提问于 2016-04-25 13:22:15
回答 1查看 5.5K关注 0票数 1

我想在Angularjs中使用Sweet Alert来获取单选按钮值。是否有一种方法可以获得选定的单选按钮值。我使用的是SweetAlert v1.1.3和ngSweetAlert指令。

代码语言:javascript
复制
SweetAlert.swal({
    title: "Please Select:",
    text: '<form> <div class=""> <input type="radio" name="csvSelect" id="radio1" ng-model="radioValue" ng-value="1" > <label for="radio1"> Whole records </label> </div> <div class=""> <input type="radio" name="csvSelect" id="radio2" ng-model="radioValue" ng-value="2" ng-click="getVal()"> <label for="radio2"> Selected records </label> </div></form>',
    html: true,
    showCancelButton: true,
    confirmButtonText: "Download it!",
    cancelButtonText: "Cancel",
    closeOnConfirm: false,
    closeOnCancel: true,
    showLoaderOnConfirm: true
},
function (isConfirm) {
    if (isConfirm) {
        SweetAlert.swal("Deleted!", $scope.radioValue, "success");
    }
});
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-04-25 14:09:31

给你- http://jsbin.com/lonotipeba/edit?js,output

我认为sweetAlert将display:none应用于输入元素。很抱歉,大单选按钮,你可以控制你的CSS。单击“下载”按钮时,您将在JS警报中看到收音机的值。

您可以在function中通过SweetAlert来完成您的目标。

单击Run 按钮查看sweetAlert。

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/36841836

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档