Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/423.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 角度,需要选中1个单选按钮才能执行操作_Javascript_Html_Angularjs - Fatal编程技术网

Javascript 角度,需要选中1个单选按钮才能执行操作

Javascript 角度,需要选中1个单选按钮才能执行操作,javascript,html,angularjs,Javascript,Html,Angularjs,我在与按钮按下关联的项目上设置了一些单选按钮(一开始没有选中)。如果没有收音机被关闭,我希望此操作不会执行任何操作(因为它需要其中一个收音机的信息) 所以我只有这个按钮: <button class="openButton" ng-click="showSubLevel = ! showSubLevel">Add Sub Level</button> 添加子级别 它使用打开另一个div <div class="addSubLevel" ng-show="show

我在与按钮按下关联的项目上设置了一些单选按钮(一开始没有选中)。如果没有收音机被关闭,我希望此操作不会执行任何操作(因为它需要其中一个收音机的信息)

所以我只有这个按钮:

<button class="openButton" ng-click="showSubLevel = ! showSubLevel">Add Sub Level</button>
添加子级别
它使用打开另一个div

<div class="addSubLevel" ng-show="showSubLevel"> 

但是,我希望按钮不做任何事情(或提醒用户),他们必须选择一个收音机来打开.addSubLevel div

收音机看起来就像这样:

<input type="radio" name="instructionLevelChecker">

因为我不确定我必须向他们添加什么才能使这项工作成功。感谢任何意见,因为我对angular还是个新手。谢谢

您可以将ng disabled=“none checked”添加到按钮:

<button class="openButton" ng-click="showSubLevel = ! showSubLevel" ng-disabled="none-checked">Add Sub Level</button>
希望这对你有帮助

<input type="radio" name="instructionLevelChecker" ng-click="changeState()>
$scope.none-checked = true;
$scope.changeState = function () {
   $scope.none-checked = false;
}