【发布时间】:2017-10-27 04:33:54
【问题描述】:
我无法在 Angular2 的 jquery 中分配多个 var。
我正在做的是:
jQuery('.source-select').on('change',(e) => this.updateForm.value.sources = jQuery(e.target).val().split('--')[0]);
这工作正常,但我想将索引 [1] 的拆分值分配给另一个对象:
jQuery('.source-select').on('change',(e) => this.updateForm.value.sources = jQuery(e.target).val().split('--')[0]
,(e) => this.selected_text = jQuery(e.target).val().split('--')[1]
);
但此时我设置了 this.selected_text 而不是 this.updateForm.value.sources 。猜猜我做错了什么。
*** 我尝试使用 on change 两次,效果很好,但我认为这样做不好。
【问题讨论】:
标签: javascript jquery typescript angular2-forms