使用 ng-repeat 但无法获得选项值!
请帮忙!html:
<ul ng-controller="app">
<li ng-repeat="mainlist in mainlists">
<p>{{mainlist.name}}</p>
<select ng-options="mainlist.list for mainlist.list in mainlists.list">
<option value="">{{mainlist.list.name}}</option>
</select>
</li>
</ul>
这个演示
js:只获取 {{mainlists.name}}不获取{{mainlists.list.name}}
function app($scope) {
$scope.mainlists = [
{
"name":"main001",
"list":[
{
"no":"1",
"name":"sub1"
},{
"no":"2",
"name":"sub2"
}]
},
{
"name":"main002",
"list":[
{
"no":"2-1",
"name":"sub1"
},{
"no":"2-2",
"name":"sub2"
}]
}]
};
这个演示