Ионный в происхождении свойства: не строка;а не LatLng или LatLngLiteral - PullRequest
0 голосов
/ 08 декабря 2018

Я хочу, чтобы источником был номер, а пунктом назначения - строка, но я получаю эту ошибку.InvalidValueError: в происхождении свойства: не строка;и не LatLng или LatLngLiteral: в свойстве lat: не число;и неизвестная собственность лат

asdasd

calculateAndDisplayRoute(directionsService, directionsDisplay) {

        this.geolocation.getCurrentPosition().then((resp) => {
            resp.coords.latitude
          resp.coords.longitude
        }).catch((error) => {
          console.log('Error getting location', error);
        });

        let watch = this.geolocation.watchPosition();
        watch.subscribe((data) => {
         this.lat=data.coords.latitude;
         this.long=data.coords.longitude;
        });
    var directionsService = new google.maps.DirectionsService;
    var directionsDisplay = new google.maps.DirectionsRenderer;
    var map = new google.maps.Map(document.getElementById('map'), {

      zoom: 5,
      center: { 
        lat: +this.lat,
        lng: +this.long
      }
    });
    directionsDisplay.setMap(map);
    directionsService.route({
      origin: {
        lat:this.lat, 
        lng:this.long
      },
      destination: this.End,
      travelMode: 'DRIVING'
    }, function(response, status) {
      if (status === 'OK') {
        directionsDisplay.setDirections(response);

      } else {
        window.alert('Directions request failed due to ' + status);
      }
    });
  }
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...