В этой функции код {draggable:'true'}
не принимается и делает ошибки:В Ionic2 Маркер лифтов не приемлем функцию Draggable?
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://{s}.tile.osm.org/{z}/{x}/{y}.png', {
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);
}
}
любая идея, чтобы решить эту проблему?
Update:
ошибка для {draggable:'true'}
:
Typescript Error Argument of type '{ draggable: string; }' is not assignable to parameter of type 'MarkerOptions'. Types of property 'draggable' are incompatible. Type 'string' is not assignable to type 'boolean
ошибка для {draggable: true}
:
Typescript Error Argument of type '{ draggable: true; }' is not assignable to parameter of type 'MarkerOptions'. Property 'options' is missing in type '{ draggable: true
Какая ошибка? – n00b
@ n00b Я обновил сообщение с ошибками. – RSA