anteaterkit / angular2-yandex-maps Goto Github PK
View Code? Open in Web Editor NEWAngular 2 components Yandex Maps.
Angular 2 components Yandex Maps.
Раньше можно было задавать центр через адрес ya-center в AngularJS
<ya-map ya-zoom="14" ya-center="{{vuz.Region}}, {{vuz.Address}}" ya-before-init="beforeInit(vuz)" ya-after-init="afterInit($target)" ya-event-click="mapClick($event)"> <ya-collection ya-options="{preset: 'islands#dotIcon',iconColor: '#1faee9', balloonMaxWidth:250}"> <ya-geo-object *ngFor="let o of geoObjects" ya-source="o"></ya-geo-object> </ya-collection> </ya-map>
.
как определить, что контрол готов к работе?
мне надо получить текущее местоположение
на этот момент ymaps еще нету
ngOnInit() {
ymaps.geolocation.get().then(function (res) {
console.log(res);
}, function (e) {
console.log(e);
});
}
How I can disable all controls?
I'm trying use empty array as argument, as ussialy in JS library, but not result
Thanks!
поставили карты с помощью npm install angular2-yandex-maps
потом указали "angular2-yandex-maps": "^1.0.40", испытав описанные ниже проблемы переустановили зависимости с помощью npm install, поведение не изменилось.
Сборка с помощью AngularCli, версия ангуляра 4.3.4
Суть проблемы
В шаблоне компонента AppComponent лежит следующее:
<ya-map [latitude]="lt" [longitude]="lg" [zoom]="8">
</ya-map>
ожидаемо получаем ругань на незнакомые элементы в шаблоне. Идём и прописываем в NgModule следующее:
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
import { MapComponent } from './map/map.component';
import { LeftBarComponent } from './left-bar/left-bar.component';
import { SubBarComponent } from './sub-bar/sub-bar.component';
import { YaCoreModule } from 'angular2-yandex-maps';
@NgModule({
imports: [
BrowserModule, YaCoreModule.forRoot()
],
declarations: [
AppComponent,
MapComponent,
LeftBarComponent,
SubBarComponent
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
на этапе загрузки страницы получаем ошибку
compiler.es5.js:1690 Uncaught Error: Unexpected value '[object Object]' imported by the module 'AppModule'. Please add a @NgModule annotation.
at syntaxError (compiler.es5.js:1690)
at compiler.es5.js:15382
at Array.forEach (<anonymous>)
at CompileMetadataResolver.webpackJsonp.../../../compiler/@angular/compiler.es5.js.CompileMetadataResolver.getNgModuleMetadata (compiler.es5.js:15365)
at JitCompiler.webpackJsonp.../../../compiler/@angular/compiler.es5.js.JitCompiler._loadModules (compiler.es5.js:26795)
at JitCompiler.webpackJsonp.../../../compiler/@angular/compiler.es5.js.JitCompiler._compileModuleAndComponents (compiler.es5.js:26768)
at JitCompiler.webpackJsonp.../../../compiler/@angular/compiler.es5.js.JitCompiler.compileModuleAsync (compiler.es5.js:26697)
at PlatformRef_.webpackJsonp.../../../core/@angular/core.es5.js.PlatformRef_._bootstrapModuleWithZone (core.es5.js:4536)
at PlatformRef_.webpackJsonp.../../../core/@angular/core.es5.js.PlatformRef_.bootstrapModule (core.es5.js:4522)
at Object.../../../../../src/main.ts (main.ts:11)
https://tech.yandex.com/maps/doc/jsapi/2.1/ref/reference/Placemark-docpage/
Placemark(geometry[, properties[, options]])
Properties.hintContent
Здравствуйте! Можно ли добавить кластер click event чтоб получать данные о выбранном маркере. Тоже самое с objectManager хотелось бы получать выбранный маркер.
Спасибо.
I am not using SystemJS, but I need to import library via NgModule annotation. This is what I got: "Please add a @NgModule annotation.":
import { YaCoreModuleForRoot } from 'angular2-yandex-maps';
...
@NgModule({
declarations: [
AppComponent,
],
imports: [
YaCoreModuleForRoot,
...
],
bootstrap: [AppComponent]
})
export class AppModule {
}
Error(from web console):
Uncaught Error: Unexpected value 'YaCoreModuleForRoot' imported by the module 'AppModule'. Please add a @NgModule annotation.
at syntaxError (compiler.es5.js:1690)
at compiler.es5.js:15382
at Array.forEach (<anonymous>)
at CompileMetadataResolver.webpackJsonp.../../../compiler/@angular/compiler.es5.js.CompileMetadataResolver.getNgModuleMetadata (compiler.es5.js:15365)
at JitCompiler.webpackJsonp.../../../compiler/@angular/compiler.es5.js.JitCompiler._loadModules (compiler.es5.js:26795)
at JitCompiler.webpackJsonp.../../../compiler/@angular/compiler.es5.js.JitCompiler._compileModuleAndComponents (compiler.es5.js:26768)
at JitCompiler.webpackJsonp.../../../compiler/@angular/compiler.es5.js.JitCompiler.compileModuleAsync (compiler.es5.js:26697)
at PlatformRef_.webpackJsonp.../../../core/@angular/core.es5.js.PlatformRef_._bootstrapModuleWithZone (core.es5.js:4536)
at PlatformRef_.webpackJsonp.../../../core/@angular/core.es5.js.PlatformRef_.bootstrapModule (core.es5.js:4522)
at Object.../../../../../src/main.ts (main.ts:11)
Реализовать добавление своей иконки из файла\кода, поддержка svg.
Hi, I ran into the connection problem of your library for Yandex angular maps. Can you help solve the problem?
ERROR in Error encountered resolving symbol values statically. Calling function 'YaCoreModule', function calls are not supported. Consider replacing the function or lambda with a reference to an exported function, resolving symbol AppModule in /home/artem-123/workspace/bycard_mobile_front/src/app/app.module.ts, resolving symbol AppModule in /home/artem-123/workspace/bycard_mobile_front/src/app/app.module.ts
This error I get when building a build, but when working out everything is compiled normally, which is wrong? Here I am connecting:
import { YaCoreModule } from 'angular2-yandex-maps';
imports: [ YaCoreModule.forRoot() ],
What is my problem? Thank you!
Каждая инициализация карты добавляет строку
<script type="text/javascript" defer="" id="YaScript" src="https://api-maps.yandex.ru/2.1/?lang=ru_RU&callback=angular2YAMapsAPILoader"></script>Возникла задача динамически изменять язык карты.
Есть ли возможность добавить @input для &lang? Или, может быть, можно это сделать как-то по-другому?
При импортировании модуля "YaCoreModule.forRoot()" появляется ошибка.
Скрин package.json http://joxi.ru/nAyYvLgS1RVjAZ
Скрин модуля, в которые требуется провести импорт http://joxi.ru/E2peEWxHZ0beAY
Трейс ошибки:
"Uncaught (in promise): Error: Unexpected value '[object Object]' imported by the module 'DepositModule'. Please add a @NgModule annotation.
Error: Unexpected value '[object Object]' imported by the module 'DepositModule'. Please add a @NgModule annotation.
at Error.ZoneAwareError (http://localhost:8080/web-polyfills.js:7863:33)
at ZoneAwareError (http://localhost:8080/web-polyfills.js:7860:35)
at syntaxError (http://localhost:8080/web-common.js:6532:34)
at http://localhost:8080/web-common.js:18999:44
at Array.forEach (native)
at CompileMetadataResolver../node_modules/@angular/compiler/@angular/compiler.es5.js.CompileMetadataResolver.getNgModuleMetadata (http://localhost:8080/web-common.js:18982:49)
at JitCompiler../node_modules/@angular/compiler/@angular/compiler.es5.js.JitCompiler._loadModules (http://localhost:8080/web-common.js:30107:64)
at JitCompiler../node_modules/@angular/compiler/@angular/compiler.es5.js.JitCompiler._compileModuleAndComponents (http://localhost:8080/web-common.js:30066:52)
at JitCompiler../node_modules/@angular/compiler/@angular/compiler.es5.js.JitCompiler.compileModuleAsync (http://localhost:8080/web-common.js:30028:21)
at ModuleBoundCompiler../node_modules/@angular/compiler/@angular/compiler.es5.js.ModuleBoundCompiler.compileModuleAsync (http://localhost:8080/web-common.js:30396:31)
at MergeMapSubscriber.project (http://localhost:8080/web-common.js:58659:140)
at MergeMapSubscriber../node_modules/rxjs/operator/mergeMap.js.MergeMapSubscriber._tryNext (http://localhost:8080/web-common.js:92008:27)
at MergeMapSubscriber../node_modules/rxjs/operator/mergeMap.js.MergeMapSubscriber._next (http://localhost:8080/web-common.js:91998:18)
at MergeMapSubscriber../node_modules/rxjs/Subscriber.js.Subscriber.next (http://localhost:8080/web-common.js:88818:18)
at http://localhost:8080/web-common.js:90365:36
at ZoneDelegate.webpackJsonp../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke (http://localhost:8080/web-polyfills.js:7235:26)
at Object.onInvoke (http://localhost:8080/web-common.js:35220:37)
at ZoneDelegate.webpackJsonp../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke (http://localhost:8080/web-polyfills.js:7234:32)
at Zone.webpackJsonp../node_modules/zone.js/dist/zone.js.Zone.run (http://localhost:8080/web-polyfills.js:7031:43)
at http://localhost:8080/web-polyfills.js:7584:57
at ZoneDelegate.webpackJsonp../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (http://localhost:8080/web-polyfills.js:7268:31)
at Object.onInvokeTask (http://localhost:8080/web-common.js:35211:37)
at ZoneDelegate.webpackJsonp../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (http://localhost:8080/web-polyfills.js:7267:36)
at Zone.webpackJsonp../node_modules/zone.js/dist/zone.js.Zone.runTask (http://localhost:8080/web-polyfills.js:7071:47)
at drainMicroTaskQueue (http://localhost:8080/web-polyfills.js:7434:35)"
Установил модуль
import { YaCoreModuleForRoot } from 'angular2-yandex-maps';
@NgModule({
imports: [
YaCoreModuleForRoot()
])}
в HTML:
<ya-map [latitude]="55.76" [longitude]="37.64">
В CSS:
.map-container-inner
{
width: 500px;
height: 500px;
}
Проблема 1:
После рендера блок карты почему-то имеет высоту 0.
Проблема 2:
После ручного исправления высоты
И клика по карте в консоле выдает:
Error: Map.getCenter: something is broken, getCenter returns NaN. Please let us know about this awful bug.
Как правильно импортировать angular2-yandex-maps?
Здравствуйте!
Подскажите пожалуйста, как работать с картами в ionic? Нигде не смог найти материалов и документации.
Добрый день.
Получается посмотреть только demo 1. В остальных в логах ошибка
Error: (SystemJS) ReferenceError: exports is not defined
at eval (https://unpkg.com/angular2-yandex-maps/lib/ya-maps-types.js:2:23)
at eval ()
at Object.eval (https://unpkg.com/angular2-yandex-maps/lib/core.module.js:19:10)
at eval (https://unpkg.com/angular2-yandex-maps/lib/core.module.js:56:4)
Evaluating https://unpkg.com/angular2-yandex-maps/lib/ya-maps-types.js
Evaluating https://unpkg.com/angular2-yandex-maps/lib/core.module.js
Evaluating https://unpkg.com/angular2-yandex-maps/index.js
Error loading https://run.plnkr.co/bFDWTNEZ2SXFOR1I/src/main.ts
ZoneDelegate.invoke @ unpkg.com/[email protected]/dist/zone.js:392
И карта справа пустая. Подскажите пожалуйста как исправить. Браузер chrome 60.0.3112.113.
Если можно, добавьте поддержку для angular 5. Спасибо.
например рядом с картой у меня список маркеров,
по клику на элементе списка я меняю свойство preset.
в элементе оно меняется, а на карте нет.
как перерисовать маркер?
selectItem(marker){ var index = this.poi.indexOf(marker, 0); if (this.poi[index].select){ this.poi[index].preset = 'islands#blueDotIcon'; }else{ this.poi[index].preset = 'islands#redDotIcon'; } this.poi[index].select = !this.poi[index].select; }
import {YaCoreModule} from 'angular2-yandex-maps';
@NgModule({
imports: [
...
YaCoreModule.forRoot()
],
...
And in template
<ya-map [latitude]="55.76" [longitude]="37.64">
<ya-marker [latitude]="55.847" [longitude]="38.6">
</ya-marker>
<ya-marker [latitude]="55.847" [longitude]="35.6">
</ya-marker>
</ya-map>
добрый день, пытаюсь показать карту
<ya-map #map [latitude]="currentPosition.lat" [longitude]="currentPosition.lng" > <ya-marker [latitude]="currentPosition.lat" [longitude]="currentPosition.lng"></ya-marker> </ya-map>
карта и маркер отображается, но нулевой высоты.
как это можно подправить?
Добрый день! Отличный модуль! спасибо вам за него! Он нам очень поможет, если мы сможем его удачно прикрутить!).
Есть несколько проблем, я надеюсь вы мне поможете.
Никак не могу найти способ управлять "controls", чтобы добавить к SearchControl параметры, например "boundedBy". Видел у вас issue на тему "работа с controls", но она закрыта. Не подскажете?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.