I got some weird error "this is null". I don't know what the problem is. This my demo Stackblitz.com and example code as your reference.
Component
ngOnInit() {
this.getCurrentLocation();
}
getCurrentLocation() {
navigator.geolocation.getCurrentPosition(position =>{
this.lat = position.coords.latitude;
this.lng = position.coords.longitude;
this.weatherInfo(this.lat, this.lng)
},function(){
this.origin = { lat: '3.140853', lng: '2.693207'};
console.log(this.origin)
this.weatherInfo(this.origin.lat, this.origin.lng)
})
}
weatherInfo(lat, lng){
console.log(lat, lng);
}