Reputation: 11205
While searching for "showing bootsrap modal in angular 2" I encountered following answer: https://stackoverflow.com/a/38271918/1291122
It simply declares jQuery as this:
declare var jQuery:any;
And uses it to show/hide modal like this:
jQuery("#myModal").modal("hide");
This was the shortest way to achieve what I need in angular 2(other all answers seemed to make it fairly complex equivalent to rocket science!)
While this is the shortest way, is it the recommended way to do it? And in general is it a good idea to use jQuery with angular 2+?
EDIT:
My question is different from How to use jQuery with Angular2? Because I am asking WHETHER(or not) to use jQuery with angular 2, while that question is about HOW to use jquery with angular 2. I already know and have mentioned How to do it.
Upvotes: 6
Views: 5414
Reputation: 236
I don't see a downside. Especially in cases where you use external libraries. However, just don't revert to Jquery trying to solve angular problems like templating etc.
Upvotes: 2
Reputation:
Yes you can use it without any problem.
This is the fastest solution, but you can have an even better one in this topic. Basically, it gives a way to have all the methods with the IDE auto complete.
Upvotes: 4