Tahun baru, skill baru! 🚀. Masukkan kupon "skill2025" untuk diskon 30% di kelas apa saja

bagaimana cara memanggil variable di type script

permisi saya masih awam di oop ,, saya mempunyai variable lat di loadmap(),, bagaimana cara memanggil nya di di cal()

 export class Ambulan {
	@ViewChild('map') mapElement: ElementRef;
	map: any;
	lat: any;
	lng: any;
	private baseURI               : string  = "http://localhost/api-medcall/";
  constructor(public navCtrl: NavController, public navParams: NavParams,
              public geolocation: Geolocation,
			  public http: Http,
              public toastCtrl  : ToastController) {
  }

  ionViewDidLoad() {
   this.loadMap();
  }

  loadMap(){{
    this.geolocation.getCurrentPosition().then((position) => {
		let  lat = position.coords.latitude;
		let  lng = position.coords.longitude;

	this.lat = lat;
    let usersLocation = {
      lat: position.coords.latitude,
      lng: position.coords.longitude
    };

      let latLng = new google.maps.LatLng(usersLocation);

      let mapOptions = {
        center: latLng,
        zoom: 15,
        mapTypeId: google.maps.MapTypeId.ROADMAP
      }

      this.map = new google.maps.Map(this.mapElement.nativeElement, mapOptions);
	  //this.call(lat, lng);

    }, (err) => {
      console.log(err);
    });
	  }
	 }

	 addMarker(){

	  let marker = new google.maps.Marker({
		map: this.map,
		animation: google.maps.Animation.DROP,
		position: this.map.getCenter()
	  });

	  let content = "<h4>Information!</h4>";

	  this.addInfoWindow(marker, content);

	}

	addInfoWindow(marker, content){

	  let infoWindow = new google.maps.InfoWindow({
		content: content
	  });

	  google.maps.event.addListener(marker, 'click', () => {
		infoWindow.open(this.map, marker);
	  });

	}

	cal(){

	}
}
avatar robbyaljufri
@robbyaljufri

1 Kontribusi 0 Poin

Dipost 7 tahun yang lalu

Belum ada Jawaban. Jadi yang pertama Jawaban

Login untuk ikut Jawaban