我在这里做错了什么? js小提琴:http://jsfiddle.net/A2qCS/4/
<div data-ng-controller="PostsController">
<label data-ng-repeat="option in options" >
<input type="radio" data-ng-modal= "options.text" data-ng-value="{{option.text}}" />{{option.text}}
<br/>
</label>
</div>
控制器:
var demoApp = angular.module('demoApp', []);
demoApp.controller('PostsController', function($scope, $http) {
$scope.options = [{ text: '1 Year Americas Best Support for Students' },
{ text: '2 Year Americas Best Support for Students' },
{ text: '3 Year Americas Best Support for Students' }
];
$scope.defaultOption = '1 Year Americas Best Support for Students';
$scope.newValue = function(value) {
console.log(value);
};
});
答案 0 :(得分:0)
<ul>
<li ng-repeat="person in peopledata" ng-init="$parent.selected = peopledata[0].jobs">
<label>{{person.jobs}}
<input type="radio" ng-model="$parent.selected" name="nameout" value="{{person.jobs}}" required />{{$parent.selected}}
</label>
</li>
</ul>
https://jsfiddle.net/beentaken/ma86cz7u/