私はangularjs.Iに新しいですラジオボタンとtextboxes.Butの複数の行を持っているフォームを持っていますcontroller.Myのラジオボタンの値を取得することができません:コントローラにラジオボタンの値を取得することができません
HTML:
<tr ng-repeat="consentinfo in listofdata" ng-disabled="abc">
<td><input type="text" class="form-control" ng-model="consentinfo.consentType"></input></td>
<td>
<input id="radio-1{{$index}}" class="radio-custom" name="radio-group{{$index}}" ng-value="consentinfo.option1" ng-model="radio1" type="radio" ng-click="radio()">
<label for="radio-1{{$index}}" class="radio-custom-label">Yes</label>
<input id="radio-2{{$index}}" class="radio-custom" name="radio-group{{$index}}" ng-value="consentinfo.option2" ng-model="radio2" type="radio" ng-click="radio()">
<label for="radio-2{{$index}}" class="radio-custom-label">No</label>
</td>
<td>
<input type="text" ng-model="consentinfo.expDate" class="form-control date" readonly>
</td>
<td>
<input type="text" ng-model="consentinfo.submittedDate" class="form-control date" readonly>
</td>
<td><input type="text" value="" class="form-control" ng-model="consentinfo.shortDescription"></td>
<td><input type="text" value="" class="form-control" ng-model="consentinfo.longDescription"></td>
</tr>
.jsファイル:
var consentManagerApp = angular.module('consentManager', []);
consentManagerApp.controller('dataOwnerController', ['$scope', function($scope) {
$scope.listofdata = [{
"consentType": "Do you consent for us to use your private data for KF Searches",
"expDate": "14-12-2017",
"submittedDate": "24-04-2017",
"option1": "true",
"option2": "false",
"status": true,
},
{
"consentType": "Consent to be contacted",
"expDate": "10-10-2017",
"submittedDate": "12-02-2017",
"option1": "true",
"option2": "false",
"status": true,
},
{
"consentType": "Consent to be solicited",
"expDate": "06-08-2017",
"submittedDate": "02-12-2017",
"option1": "true",
"option2": "false",
"status": true,
},
{
"consentType": "Consent to participate in Trend studies",
"expDate": "10-11-2017",
"submittedDate": "12-02-2017",
"option1": "true",
"option2": "false",
"status": true,
},
{
"consentType": "Consent to participate in recruiting practice",
"expDate": "10-10-2017",
"submittedDate": "12-02-2017",
"option1": "true",
"option2": "false",
"status": true,
}
];
$scope.submitConsent = function() {
alert('CTY=' + $scope.choices[0] + 'O2=' + $scope.choices[1]);
alert('Listdata=' + $scope.radio1 + " " + "O2=" + $scope.radio2);
}]);
consentManagerApp.filter('unsafe', function($sce) {
return $sce.trustAsHtml;
});
は、いずれかが、私は.Iがデータベースに永続化する必要がある値を取得することができますどのように私を導くことができます。ラジオボタンの値を取得していないため、あなたの問題を解決します
よろしく、 Prabhash
「フィドル」をご提供できますか? –
以下の回答を参照してください。それが正しいかどうかを確かめてください –