dimanche 12 février 2017

In Ionic2 Leaflet marker is not accept Draggable feature?

Vote count: 0

In this code {draggable:'true'}feature is not accepted and makes error:

import { Component, OnInit } from '@angular/core';
import { NavController } from 'ionic-angular';

import * as Leaflet from 'leaflet';

@Component({
  selector: 'page-street',
  templateUrl: 'street.html'
})
export class StreetPage {
 private latLng: any;
  private marker: any;
  private map: any;  
  constructor(public navCtrl: NavController) {

  }
  ngOnInit(): void {
    this.drawMap();
  }
  drawMap(): void {
    let map = Leaflet.map('map');
    Leaflet.tileLayer('http://ift.tt/1lSj3Er', {
      maxZoom: 15
    }).addTo(map);

    map.locate({ setView: true});
    function onLocationFound(e) {      
      var radius = e.accuracy / 3;     
      Leaflet.marker(e.latlng, {draggable:'true'}).addTo(map);
      Leaflet.circle(e.latlng, radius).addTo(map);
    }
    map.on('locationfound', onLocationFound);
    //alert on location error
    function onLocationError(e) {
      alert(e.message);
    }
    map.on('locationerror', onLocationError);
  }   
}

any Idea to solve it?

asked 16 secs ago

Let's block ads! (Why?)



In Ionic2 Leaflet marker is not accept Draggable feature?

Aucun commentaire:

Enregistrer un commentaire