I will show you the way I implemented it but I'm not sure if it's a proper way to do it though.
The idea is:
First, I add a hidden input to record the change of map object simultaneously:
<input hidden id='hiddenMapValue' #hiddenInput>
#hiddenInput
is there for a purpose and you'll see it.
Then, every time map object changes, assign the value to this hidden input, for example:
$("#hiddenMapValue").val(place.geometry.location).trigger('change');
In your component:
@ViewChild('hiddenInput') hiddenInput: ElementRef;
ngAfterViewInit(){
$(this.hiddenInput.nativeElement).on('change', (e)=>{
this.onInputChanged(e);
});
}
private onInputChanged(e): void{
//This is your changed location value
console.log(e.target.value);
}
@ViewChild('hiddenInput') hiddenInput: ElementRef;
is how you get a hold on hidden input #hiddenInput
.
And no, angular 2 model does not record changes made by jQuery. This is an alternate solution to this problem, so far.
I hope this will help.