How to use jquery in Angular 7?

I’m trying to implement jquery on my angular7 project but it didn’t work.

There’s no reason to use jQuery in an Angular app, or honestly any app that doesn’t have to support IE 9 or below.

What functionality are you trying to use it for?

I’m a beginner to angular and trying to implement what I’ve learned before in basic web development. I’m trying to build a functional hamburger menu on my angular project.

Gotcha. You’d want to do this entirely with Angular functionality. Angular is more or less a DOM abstraction library, where as jQuery is a DOM manipulation library. You don’t want to mix these concepts, because you’ll never know who has control of your components. To put it another way, in this context, they are 2 libraries that try to do the same thing in very different things.

3 Likes

Thank You for your kind response. Earlier I watched youtube video regarding this topic, and everything went well as it taught except for the hamburger menu it didn’t work.

Ohhh, this is Bootstrap. That makes more sense. I thought you were directly trying to write something to build it yourself.

What do the errors in your console say?

i got one error that is “Uncaught SyntaxError: Unexpected token export” scripts.js.
yes i used bootstrap too, and bootstrap is working fine but the hamburger menu doesn’t work.

That sounds like your build isn’t working. If you’re getting this error it means something in your build step is messing up, because export should never be making it to the browser.

Is any of your Angular stuff working?

yes angular is running fine. may be i should try another way. thank you so much for your time and guidance.

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.