Angularjs ng内的md无线电组重复

Angularjs ng内的md无线电组重复,angularjs,angularjs-ng-repeat,ng-repeat,angular-material,radio-group,Angularjs,Angularjs Ng Repeat,Ng Repeat,Angular Material,Radio Group,我正在整理一份调查问卷。每个问题都插入一个ng重复,每个问题都有多项选择项。我使用angular material的md单选组将这些多选项作为单选按钮插入。 在问题1的三个单选按钮中选择一个,将反映以下所有问题。感谢您的帮助 更新:我创建了一个复制问题的代码笔。网址: 您正在使用相同的范围变量来存储所有答案。每个答案都需要单独的变量。看看这支笔。我刚刚又添加了一个字段来存储问题对象中的答案 你也能给你提供js文件吗?我需要看看你的对象的结构和逻辑。谢谢你的详细问题。你试过我的naswer吗??

我正在整理一份调查问卷。每个问题都插入一个ng重复,每个问题都有多项选择项。我使用angular material的md单选组将这些多选项作为单选按钮插入。 在问题1的三个单选按钮中选择一个,将反映以下所有问题。感谢您的帮助

更新:我创建了一个复制问题的代码笔。网址:


您正在使用相同的
范围
变量来存储所有答案。每个答案都需要单独的变量。看看这支笔。我刚刚又添加了一个字段来存储
问题
对象中的答案


你也能给你提供
js
文件吗?我需要看看你的
对象的结构
逻辑
。谢谢你的详细问题。你试过我的naswer吗???是的。看起来很棒。问题,即使我在控制器中使用别名,也应该使用ng模型吗?别名是“asaq”。是的。这种方法没有错。事实上,用这种方式对数据建模是件好事。非常感谢你!没问题……)
<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>
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) {
});