这是我的代码。当我提交switchColors时,服务器返回undefined。这怎么回事?
另外我应该如何在我的控制器中启动$ 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>
答案 0 :(得分:1)
尝试使用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>