Anonymous
Карта листовок не отображается, отсутствует некоторые детали [дублировать]
Сообщение
Anonymous » 08 май 2025, 14:24
После рендеринга компонента листовок в моем угловом приложении некоторые карты-изображения/плитки отсутствуют, вот мой код
Код: Выделить всё
import { Component, Inject, PLATFORM_ID } from '@angular/core';
import { isPlatformBrowser } from '@angular/common';
import { DOCUMENT } from '@angular/common';
@Component({
selector: 'app-leaflet-offline-maps',
standalone: true,
imports: [],
templateUrl: './leaflet-offline-maps.component.html',
styleUrls: ['./leaflet-offline-maps.component.css']
})
export class LeafletOfflineMapsComponent {
private isBrowser: boolean;
constructor(
@Inject(PLATFORM_ID) private platformId: Object,
@Inject(DOCUMENT) private document: Document
) {
this.isBrowser = isPlatformBrowser(platformId);
}
async ngOnInit(): Promise {
if (this.isBrowser) {
const L = await import('leaflet');
const map = L.map('map').setView([42.4304, 19.2594], 13);
L.tileLayer('http://localhost:8080/tile/{z}/{x}/{y}.png', {
attribution: '© OpenStreetMap contributors'
}).addTo(map);
}
}
}
< /code>
и < /p>
Также я уже установлен лист>
Подробнее здесь:
https://stackoverflow.com/questions/796 ... some-parts
1746703475
Anonymous
После рендеринга компонента листовок в моем угловом приложении некоторые карты-изображения/плитки отсутствуют, вот мой код [code]import { Component, Inject, PLATFORM_ID } from '@angular/core'; import { isPlatformBrowser } from '@angular/common'; import { DOCUMENT } from '@angular/common'; @Component({ selector: 'app-leaflet-offline-maps', standalone: true, imports: [], templateUrl: './leaflet-offline-maps.component.html', styleUrls: ['./leaflet-offline-maps.component.css'] }) export class LeafletOfflineMapsComponent { private isBrowser: boolean; constructor( @Inject(PLATFORM_ID) private platformId: Object, @Inject(DOCUMENT) private document: Document ) { this.isBrowser = isPlatformBrowser(platformId); } async ngOnInit(): Promise { if (this.isBrowser) { const L = await import('leaflet'); const map = L.map('map').setView([42.4304, 19.2594], 13); L.tileLayer('http://localhost:8080/tile/{z}/{x}/{y}.png', { attribution: '© OpenStreetMap contributors' }).addTo(map); } } } < /code> и < /p> [/code] Также я уже установлен лист> Подробнее здесь: [url]https://stackoverflow.com/questions/79612084/leaflet-map-doesnt-render-missing-some-parts[/url]