Closed bayismet closed 5 years ago
You pass as contextMenu the [contextMenu]="basicMenu"
but you don't assign to <context-menu>
.
This propably fix this:
<context-menu #basicMenu>
Actually, I'm using just one menu so I thought I could pass that. I just realized that the problem is caused by the map library. I changed my map from "yaga" to "agm", so it works now!
Although it gave me some error inside "this.contextMenuService.show.next()" block about "event". I just dealt with it like this:
showMessage(marker) {
localStorage.setItem('markerID', marker.id);
this._ContextMenuService.show.next({
// Optional - if unspecified, all context menu components will open
contextMenu: this.basicMenu,
event: new MouseEvent('markerRightClick'),
item: marker,
anchorElement: document.getElementById('marker1')
});
}
Hope anyone can understand and solve their problem too!
Hello there!
I'm trying to do something different that fits my project. I have map and markers on it. I need to open that menu, when I click a marker. That's how I try so far: main.component.html
main.component.ts
When I give that [contextMenu] property to the map itself, it opens everywhere the same menu. I need to open a menu on marker click, and another menu for everywhere else.
Hope I'm clear and get an answer soon. Thanks!