Geo*_*ith 5 javascript radio-button angularjs
我正在尝试从单选列表中的单选按钮中检查一个,但是没有运气。
有人可以告诉我我在做什么错吗?
谢谢你的帮助。
我试图通过这种方式做到这一点:
<div class="list">
<ion-radio ng-repeat="item in goalTypeList"
ng-value="item.value"
ng-change="goalTypeChanged(item)"
ng-checked="item.selected"
ng-model="data.clientSide">
{{ item.text }}
</ion-radio>
</div>
Run Code Online (Sandbox Code Playgroud)
JS:
.controller('SettingsCtrl', function($scope, $ionicLoading) {
$scope.goalTypeList = [
{ text: "Dials", value: "dials", selected: true },
{ text: "Conversations", value: "conversations" , selected: false },
{ text: "Appointments", value: "appointments" , selected: false },
{ text: "Orders", value: "orders", selected: false }
];
$scope.data = {
clientSide: 'ng'
};
$scope.goalTypeChanged = function(item) {
console.log("Selected goalType, text:", item.text, "value:", item.value);
};
Run Code Online (Sandbox Code Playgroud)
您 中的值$scope.data = { clientSide: 'ng' };与 中的任何值都不匹配$scope.goalTypeList。
如果客户端值$scope.data是拨号、对话、约会或订单,则单选按钮应加载所选的单选按钮之一。
我希望这有帮助。
| 归档时间: |
|
| 查看次数: |
12541 次 |
| 最近记录: |