答案 0 :(得分:0)
您可以将select
写为:
<select ng-model="n.selected" ng-change="onChange(n.selected, $index)">
但是它要求langInput.values
应该是对象列表而不是整数
$scope.langInput = {
count: 3,
values: [
{
id:1,
selected: "eng"
},
{
id:2,
selected: "eng"
}
],
add: function() {
this.values.push({id:this.count,selected: "eng"});
this.count += 1;
console.log(this.values);
},
remove: function() {
this.values.pop();
this.count -= 1;
console.log(this.values);
}
};
$scope.onChange = function(value, index){
$scope.langInput.values[index].selected = value;
}