I'm working with Angular 2 (Typescript) on Ionic 2 App. I have one class NewFavoriteSitePage
with private property siteForm
and I can use this property in class methods but when I am inside one google maps method this variable is undefined. What are the scope of variable or How do I define the variable to access from both sides?
declare var google;
......
export class NewFavoriteSitePage {
.....
private siteForm: FormGroup;
loadMap(){
//I can access to siteForm here!
.....
google.maps.event.addListener(marker, 'dragend', function(marker, siteForm){
let newlatLng = marker.latLng;
console.log(this.siteForm); //Here this.siteForm is undefined
});
}
No comments:
Post a Comment