我尝试使用单选按钮在html div之间切换。在页面加载时,我想选择第一个单选按钮和相应的html div,但当我单击其他单选按钮时,它应该显示其他div,然后单击相应的单选按钮在div之间切换
我尝试了以下解决方案
<div class="form-check">
<label class="form-check-label">
<input class="form-check-input radio-inline" type="radio" id="gridRadios1" ng-click="ShowFamilyGroup('YES');">
Family Group</label>
<label class="form-check-label">
<input class="form-check-input radio-inline" type="radio" id="gridRadios2" ng-click="ShowSingle('YES');">
Single</label>
</div>
<div ng-show="IsFamilyGroupVisible">
<p>This is family Group</p>
</div>
<div ng-show="IsSingleVisible">
<p>This is Individual</p>
</div>
这是Angular 代码
$scope.ShowFamilyGroup = function (value) {
$scope.IsFamilyGroupVisible = value == "YES";
};
$scope.ShowSingle = function (value) {
$scope.IsSingleVisible = value == "YES";
};
我希望在页面上选中LoadFamilyGroup单选按钮,并显示相应的div,然后如果用户单击单个其他div,则显示隐藏族组,反之亦然
1条答案
按热度按时间xurqigkl1#
控制器代码
html代码
希望它能很容易地帮助你。