radio 取得的值为string,不是boolean类型
<button ng-class="x.canLive?'btn-success':'btn-danger'" ng-repeat="x in arr" ng-click='btnClick(x)' ng-bind='x.a'><br/></button>
<input name="display" type="radio" value=true ng-model="newDisplay.canLive" ng-checked="newDisplay.canLive===true"> 显示
<input name="display" type="radio" value=false ng-model="newDisplay.canLive" ng-checked="newDisplay.canLive===false"> 隐藏
<button ng-click='sure()' ng-disabled='sureBtn'>确认</button>
if (typeof($scope.newDisplay.canLive) != "boolean") {
$scope.newDisplay.canLive = $scope.newDisplay.canLive === "false" ? false : true;
}
需要去判断改变为boolean类型
$scope.thisX = x;
$scope.newDisplay = angular.copy(x)
使用copy,改变值的时候,将不改变原来数组的值