-
Notifications
You must be signed in to change notification settings - Fork 7
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
TypeError: window.jQuery(...).maphilight is not a function / Make it work with import 'jquery'; from npm #5
Comments
I assume the problem is that you're trying to import jQuery from the npm package. I don't actually know why that wouldn't work the way you tried it. Maybe someone else could explain why it doesn't? All I can say is that the only way I have used this component so far is in a project that already had jQuery available globally on
However, as I mentioned on https://github.com/TylerRick/angular-maphilight, I would love it if someone figured out how to get it to work to use npm only to load those 2 dependencies.
If you figure it out, please post here and if possible submit a pull request. In the meantime, you may have to resort to including jQuery via a |
Oh, I just re-read the error message, and I see that it's not complaining about jQuery itself, but about See, Maphilight is jQuery plugin that you need to load in addition to core jQuery. Did you import/include the Maphilight jQuery plugin?? I don't even know if there is a way to make a jQuery plugin as a npm package, but you could research and find out, and if it is possible, if there's not already a npm package for the Maphilight jQuery plugin, you could add one :) |
Hi @TylerRick , I am the one who sent the email about this issue. Regarding the Maphilight plugin , I imported it via npm and everything is working fine now. The error message was because JQuery was not defined globally correctly as window.jQuery and maphilight was not accessible. |
Glad you got it working! |
I have the same issue now, Regards, |
Hi, That simple :) |
It works |
Hi, I've installed jquery and maphilight via npm and put them into the angular.json scripts tag and it works with angular 10:
|
Someone asked:
I'm trying to implement your angular-maphilight directive into my application, but I'm always getting this error:
I tried to solve this by declaring window. jQuery as a global namespace, by doing the following:
also this:
but none of these worked, what do you recommend me to do?
The text was updated successfully, but these errors were encountered: