アンケートをまとめています。各質問にはng-repeatが挿入され、各質問には複数の選択項目があります。私は、角度材料のmd-radio-groupを使ってラジオボタンとしてこれらの複数の選択項目を挿入しています。 質問1の3つのラジオボタンのいずれかを選択すると、以下のすべての質問が反映されます。どんな助けもありがとうございます。nd-repeat内のmd-radio-group
更新:問題を複製するCodePenを作成しました。で発見:
<div class="main" ng-app="MyApp">
<div ng-controller="AppCtrl as asaq">
<h1>{{ asaq.title }}</h1>
<form name="collection" novalidate>
<div class="questionnaire">
<div class="questions">
<div class="question" ng-repeat="question in asaq.questions">
<h2>Question {{ question.hrsQuestionOrderNumber }} <span>of {{ asaq.questions.length }}</span></h2>
<p>
{{ question.descriptionLong }}
</p>
<div class="options">
<md-radio-group ng-model="asaq.answers.group">
<md-radio-button ng-repeat="option in question.choiceModels" ng-value="option.description254" required>
{{ option.description254 }}
</md-radio-button>
</md-radio-group>
</div>
</div>
</div>
</div>
</form>
</div>
</div>
Javascriptを:
angular
.module('MyApp',['ngMaterial', 'ngMessages'])
.controller('AppCtrl', function() {
var self = this;
self.title = 'md-radio-group within ng-repeat';
self.questions = [
{
"hrsQuestionOrderNumber": 1,
"descriptionLong": "Do you collect money from anyone?",
"choiceModels": [
{
"description254": "Yes"
},
{
"description254": "No"
},
{
"description254": "None/Not applicable",
}
]
},
{
"hrsQuestionOrderNumber": 2,
"descriptionLong": "Are pre-numbered receipts given to the person paying money?",
"choiceModels": [
{
"description254": "Yes"
},
{
"description254": "No",
},
{
"description254": "None/Not applicable"
}
]
},
{
"hrsQuestionOrderNumber": 3,
"descriptionLong": "Do cash receipts or logs contain sufficient detail to accurately describe the nature of the transaction?",
"choiceModels": [
{
"description254": "Yes"
},
{
"description254": "No"
},
{
"description254": "None/Not applicable"
}
]
},
{
"hrsQuestionOrderNumber": 4,
"descriptionLong": "Do receipts or logs identify individuals and not groups of individuals?",
"choiceModels": [
{
"description254": "Yes"
},
{
"description254": "No"
},
{
"description254": "None/Not applicable"
}
]
},
{
"hrsQuestionOrderNumber": 5,
"descriptionLong": "For money collected, is it always deposited and never used for purchases?",
"choiceModels": [
{
"description254": "Yes",
},
{
"description254": "No"
},
{
"description254": "None/Not applicable"
}
]
},
{
"hrsQuestionOrderNumber": 6,
"descriptionLong": "For money not yet deposited, is it kept in a secure location?",
"choiceModels": [
{
"description254": "Yes"
},
{
"description254": "No"
},
{
"description254": "None/Not applicable"
}
]
},
{
"hrsQuestionOrderNumber": 7,
"descriptionLong": "Do you keep a file of original deposit documentation—including cash receipts or logs—together?",
"choiceModels": [
{
"description254": "Yes"
},
{
"description254": "No"
},
{
"description254": "None/Not applicable"
}
]
}
];
})
.config(function($mdIconProvider) {
});
'js'ファイルも提供できますか?私はあなたの 'オブジェクト'と 'ロジック'の構造を見る必要があります。 – nextt1
詳細な質問ありがとうございます。 – nextt1
あなたは私のナースベルを試しましたか? – nextt1