Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

not working with ol4.5 with webpack #127

Closed
niteshgoyal19 opened this issue Nov 30, 2017 · 12 comments
Closed

not working with ol4.5 with webpack #127

niteshgoyal19 opened this issue Nov 30, 2017 · 12 comments

Comments

@niteshgoyal19
Copy link

gives an error of appendChild of undefined

@jonataswalker
Copy link
Owner

@niteshgoyal19 Please provide a fiddle to show your issue.

@anste
Copy link

anste commented Dec 29, 2017

I have the same issue. How can I import ol-contextmenu when using ol with webpack?

import ContextMenu from 'ol-contextmenu';

leads to this error when instantiating the menu:

Uncaught TypeError: Cannot read property 'appendChild' of undefined
    at s.tg.setMap

Is there another way to import the menu?
I can't provide a fiddle since I don't know how to implement it using javascript modules.

@jonataswalker
Copy link
Owner

It could be a relevant repository. I don't have experience with webpack.

@anste
Copy link

anste commented Jan 3, 2018

Maybe it's not working because I use the new openlayers package ol. I don't think it's a webpack issue.

@wangmeijian
Copy link

I have the same issue. "ol": "^4.6.4"

@tiagowippel
Copy link

Same here, using latest version of OL...

@rockit666
Copy link

Hi..
I don't know if this is the same issue but it's the same error message at map.addControl.
I tried the code from example.

this.contextmenu_items = [
  {
    text: 'what is here ?',
    // icon: this.pin_icon,  // this can be relative or absolute
    callback: this.searchAddressFromPoint
  },
  '-' // this is a separator
];

this.contextmenu = new ContextMenu({
width: 170,
defaultItems: true,
items: this.contextmenu_items // defaultItems are (for now) Zoom In/Zoom Out
});

this.map.addControl(this.contextmenu);

@jonataswalker
Copy link
Owner

Hey guys, I'll try to come out with a solution ASAP.

@jonataswalker
Copy link
Owner

Please, see if this is fixed in v3.2.0.

@tiagowippel
Copy link

It worked! Thank you.

@rockit666
Copy link

It works, Thanks, you save my day :-)

@Panchashila
Copy link

hey am adding ol-contextmenu in my angular app and ol-5.x and
getting issue like
ol-contextmenu.js:7 Uncaught TypeError: Cannot read property 'control' of undefined
at ol-contextmenu.js:7
at ol-contextmenu.js:7
(anonymous) @ ol-contextmenu.js:7
(anonymous) @ ol-contextmenu.js:7
AppComponent.html:3 ERROR ReferenceError: contextmenu is not defined
at MapComponent.push../src/app/map/map.component.ts.MapComponent.ngOnInit (map.component.ts:109)
at checkAndUpdateDirectiveInline (core.js:9250)
at checkAndUpdateNodeInline (core.js:10514)
at checkAndUpdateNode (core.js:10476)
at debugCheckAndUpdateNode (core.js:11109)
at debugCheckDirectivesFn (core.js:11069)
at Object.eval [as updateDirectives] (AppComponent.html:4)
at Object.debugUpdateDirectives [as updateDirectives] (core.js:11061)
at checkAndUpdateView (core.js:10458)
at callViewAction (core.js:10699)

tell me what is issue as am doing something wrong please let me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants