如何在AngularJS中设置单选button的默认值?

我需要build立一个系统,通过select的票数来改变总价格。 我创build了一些单选button来select票数。 其中的优点是,默认值是未设置的,加载结果为空。

<input type="radio" ng-model="people" value="1" checked="checked"><label>1</label> <input type="radio" ng-model="people" value="2"><label>2</label> <input type="radio" ng-model="people" value="3"><label>3</label> <ul> <li>{{10*people}}€</li> <li>{{8*people}}€</li> <li>{{30*people}}€</li> </ul> 

请看我的jsfiddle。

用ngInit为people设定一个默认值

 <div ng-app> <div ng-init="people=1" /> <input type="radio" ng-model="people" value="1"><label>1</label> <input type="radio" ng-model="people" value="2"><label>2</label> <input type="radio" ng-model="people" value="3"><label>3</label> <ul> <li>{{10*people}}€</li> <li>{{8*people}}€</li> <li>{{30*people}}€</li> </ul> </div> 

演示: 小提琴

 <div ng-app="" ng-controller="myCntrl"> <input type="radio" ng-model="people" value="1"/><label>1</label> <input type="radio" ng-model="people" value="2"/><label>2</label> <input type="radio" ng-model="people" value="3"/><label>3</label> </div> <script> function myCntrl($scope){ $scope.people=1; } </script> 

为什么不只是ng-checked="true"

 <input type="radio" name="gender" value="male"<%=rs.getString(6).equals("male") ? "checked='checked'": "" %>: "checked='checked'" %> >Male <%=rs.getString(6).equals("male") ? "checked='checked'": "" %>