[英]select options not updating dynamically with angular 2 bindings
因为当你reassinging options
的值必须指向options
通过使用当前this
之前options
。
handleChange(event) {
console.log(event.target.value);
//this to indicate options from current class
this.options = [{id: 0, name:"First"}, {id: 1, name:"Second"}, {id: 2, name:"Third"}];
this.selected1 = this.options.filter((option) => {
return option.id == event.target.value;
})[0];
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.