I am having trouble assigning more than one variable in jQuery within Angular2.
Here is my current code:
jQuery('.source-select').on('change',(e) => this.updateForm.value.sources = jQuery(e.target).val().split('--')[0]);
This code works perfectly, but I want to assign the split value at index [1] to another object as well:
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]
);
However, currently only this.selected_text is being set and not this.updateForm.value.sources. Any idea what I am doing wrong?
*** I have tried using 'on change' twice and it works fine, but I don't think it's a good practice.