使用ng-checked内部ng-if条件的值

时间:2015-01-10 09:25:33

标签: angularjs

<div class="radio">
   <label><input  type="radio" ng-model="tb3r4" value="0" ng-checked="true">Do not specify</label>
</div>
 <div class="radio">
  <label><input type="radio" ng-model="tb3r4" value="1">Yes</label>
   </div>
 <div class="radio">
  <label><input type="radio" ng-model="tb3r4" value="2">No</label>
  </div>
</div>

现在我正在检查条件

<span ng-if="tb3r4==0">None specified</span>

这种情况无效

1 个答案:

答案 0 :(得分:0)

而不是使用ng-checked。将模型值初始化为0.这应该在您的控制器中完成。

app.controller('MainCtrl', function($scope) {
  $scope.tb3r4 = 0;
});

<div class="radio">
   <label><input  type="radio" ng-model="tb3r4" value="0">Do not specify</label>
</div>

Plunkr