gpt4 book ai didi

javascript - Ionic + Angular 默认无法勾选ion-radio

转载 作者:搜寻专家 更新时间:2023-11-01 04:25:02 24 4
gpt4 key购买 nike

我正在尝试从单选列表中的单选按钮中检查一个,但没有运气。

有人能告诉我我做错了什么吗?

感谢您的帮助。

我试过这样做:

<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>

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);
};

最佳答案

似乎data.clientSide的值不在列表goalTypeList中。更改值以匹配任何..

html:

<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>

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: 'appointments'
};

$scope.goalTypeChanged = function(item) {
console.log("Selected goalType, text:", item.text, "value:", item.value);
};

关于javascript - Ionic + Angular 默认无法勾选ion-radio,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26039271/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com