は{draggable:'true'}
機能が受け入れられ、エラーになりません。Ionic2リーフレットマーカーは受け入れられませんドラッグ可能な機能?このコードで
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);
}
}
それを解決するための任意のアイデア?
更新:{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