Hi everyone, I'm diving into the world of typescript and JQuery. I have a simple question. In my typescript class called DatePicker, I am calling a function. Here's a snippet of the code:
Class DatePicker {
private pickerData;
public update() {
thisi.pickerData = '';
$('#reportrange').on('apply.daterangepicker', function(ev, picker: any) {
// return "picker" object to Class level property "pickerData"
});
}
}
The function is being called successfully but I am facing an issue where I want to return the "picker" object outside of the jQuery function and assign it to pickerData. The problem is that inside the jQuery function, the Class 'this' is not accessible. I want to avoid using static properties in the class because I want to maintain the flow back to the class from the jQuery function. Can anyone offer some guidance on how to solve this?