我想在Angularjs中使用Sweet Alert来获取单选按钮值。是否有一种方法可以获得选定的单选按钮值。我使用的是SweetAlert v1.1.3和ngSweetAlert指令。
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");
}
});发布于 2016-04-25 14:09:31
给你- http://jsbin.com/lonotipeba/edit?js,output
我认为sweetAlert将display:none应用于输入元素。很抱歉,大单选按钮,你可以控制你的CSS。单击“下载”按钮时,您将在JS警报中看到收音机的值。
您可以在function中通过SweetAlert来完成您的目标。
单击Run 按钮查看sweetAlert。
https://stackoverflow.com/questions/36841836
复制相似问题