这是我的代码。当我提交 switchColors 时,服务器为其返回未定义。这是怎么错的?
另外,我应该如何在 Controller 中启动 $scope.swichColors ?目前我有 $scope.switchColors = '';
<label class="radio-inline">
<input type="radio" ng-model="$parent.switchColors" value = "yes" >Yes</input>
</label>
<label class="radio-inline">
<input type= "radio" ng-model = "$parent.switchColors" value = "no" >No</input>
</label>
最佳答案
尝试使用 ng-value 而不是 value
<label class="radio-inline">
<input type="radio" ng-model="$parent.switchColors" ng-value = "yes" >Yes</input>
</label>
<label class="radio-inline">
<input type= "radio" ng-model = "$parent.switchColors" ng-value = "no" >No</input>
</label>
关于javascript - 如何在 Angular 中制作单选按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36833895/