ddubrava / angular-yandex-maps

πŸ—ΊοΈ Yandex.Maps Angular components that implement the Yandex.Maps JavaScript API
https://ddubrava.github.io/angular8-yandex-maps/#/
MIT License
57 stars 7 forks source link

Uncaught (in promise): ReferenceError: ymaps is not defined #64

Closed sa-va closed 3 years ago

sa-va commented 3 years ago

Π²ΠΎΠ·ΠΌΠΎΠΆΠ½ΠΎ Π»ΠΈ использованиС Π² lazy-loaded ΠΌΠΎΠ΄ΡƒΠ»Π΅ с ΠΊΠ°Ρ€Ρ‚ΠΎΠΉ (для создания ΠΌΠ΅Ρ‚ΠΊΠΈ с собствСнным ΠΈΠ·ΠΎΠ±Ρ€Π°ΠΆΠ΅Π½ΠΈΠ΅ΠΌ)

myIconContentLayout = ymaps.templateLayoutFactory.createClass(
    '<div style="color: #FFFFFF; font-weight: bold;">$[properties.iconContent]</div>'
);

? появляСтся ошибка "ReferenceError: ymaps is not defined"

angular8-yandex-maps v11.0.1

sa-va commented 3 years ago

ΠΈ ΠΊΠ°ΠΊ Π² angular8-yandex-maps v11.0.1 ΡƒΡΡ‚Π°Π½ΠΎΠ²ΠΈΡ‚ΡŒ bounds ΠΊΠ°Ρ€Ρ‚Ρ‹? Ρ‡Π΅ΠΌ Π·Π°ΠΌΠ΅Π½ΠΈΡ‚ΡŒ ΠΊΠΎΠ΄? public onLoad(event: ILoadEvent) { this.mapComponent = event.instance; }

ddubrava commented 3 years ago

Π²ΠΎΠ·ΠΌΠΎΠΆΠ½ΠΎ Π»ΠΈ использованиС Π² lazy-loaded ΠΌΠΎΠ΄ΡƒΠ»Π΅ с ΠΊΠ°Ρ€Ρ‚ΠΎΠΉ (для создания ΠΌΠ΅Ρ‚ΠΊΠΈ с собствСнным ΠΈΠ·ΠΎΠ±Ρ€Π°ΠΆΠ΅Π½ΠΈΠ΅ΠΌ)

myIconContentLayout = ymaps.templateLayoutFactory.createClass(
    '<div style="color: #FFFFFF; font-weight: bold;">$[properties.iconContent]</div>'
);

? появляСтся ошибка "ReferenceError: ymaps is not defined"

angular8-yandex-maps v11.0.1

<ya-map (ready)="onReady($event)">
public onReady(e: YaReadyEvent<ymaps.Map>): void {
  const { ymaps, target } = e;

  const CustomLayoutClass = ymaps.templateLayoutFactory.createClass(
    '<ul>' +
      '{% for name in properties.names %}' +
      '<li>{{ name }}</li>' +
      '{% endfor %}' +
      '</ul>',
  );

  const placemark = new ymaps.Placemark(
    [55.74, 37.58],
    { names: ['Logan', 'Sofia', 'Mason', 'Layla'] },
    // any as IPlacemarkOptions is missing balloonContentLayout
    { balloonContentLayout: CustomLayoutClass } as any,
  );

  target.geoObjects.add(placemark);
}
ddubrava commented 3 years ago

ΠΈ ΠΊΠ°ΠΊ Π² angular8-yandex-maps v11.0.1 ΡƒΡΡ‚Π°Π½ΠΎΠ²ΠΈΡ‚ΡŒ bounds ΠΊΠ°Ρ€Ρ‚Ρ‹? Ρ‡Π΅ΠΌ Π·Π°ΠΌΠ΅Π½ΠΈΡ‚ΡŒ ΠΊΠΎΠ΄? public onLoad(event: ILoadEvent) { this.mapComponent = event.instance; }

public onReady(e: YaReadyEvent<ymaps.Map>): void {
  const { target } = e;
  target.setBounds(...);
}