【发布时间】:2017-10-16 06:40:14
【问题描述】:
所以在按钮点击我添加新的选择,在删除我删除数组的最后一个成员。现在我想将选定的值移动到下面的列表中。
这是我的代码:
$scope.langInput = {
count: 3,
values: [1, 2],
add: function() {
this.values.push(this.count);
this.count += 1;
console.log(this.values);
},
remove: function() {
this.values.pop();
this.count -= 1;
console.log(this.values);
}
};
This是我的代码的工作演示。我想将选定的选项移动到<ol> 列表。提前致谢。
【问题讨论】:
-
您是否尝试过使用
list的onchange事件并将所选项目添加到ol? -
不,我想不通你能编辑我的 plunker 并显示示例吗?
-
我不知道如何在 Angular 中做到这一点,但这里是普通 JS (ES6) 中的示例。 jsfiddle.net/rpneLdma
-
好吧,我在 angularJS 中需要这个,并且按钮必须存在。
标签: javascript angularjs angularjs-ng-repeat