I would like to emit a new value to my BehaviourSubject when Google Maps Api has been loaded, but I cannot acces to class parameters, code:
private isInitialized = new BehaviorSubject<boolean>(false);
private initialization() {
// Load Google Maps Api script
var script = document.createElement('script');
script.src = 'https://maps.googleapis.com/maps/api/js?key=' + environment.googlePlaces.apiKey + '&libraries=places&callback=initMap';
script.async = true;
window['initMap'] = function () { debugger; this.isInitialized.next(true); }
document.head.appendChild(script);
}
I enter in debugger, but this is associated to something else than the class.
How can I connect this to the instance of my class?