How to force angular to use jqlite or manually reference a jquery object

I am stuck with an incompatible version of jQuery in my Angular application, I cannot update jQuery, but I can download the latest jQuery side by side using the noConflict method, but I cannot find a way to force Angular.js to use the new jQuery version. Is there such a method?

Flow

<head> <script src="jQuery 1.3.2"> <script src="old jquery code"> </head> <body><script src="jQuery 1.10.2"/> <script> var newjquery = jQuery.noConflict(); </script> <script src="angular.js"/> <script> // angular code </script> </body> 
+6
source share
2 answers

From the docs :

Does Angular use jQuery library?

Yes, Angular can use jQuery if it is present in your application when the application loads. If jQuery is not in your script path, Angular returns to its own implementation of a subset of jQuery, which we call jQLite.

Try changing the position at which you import the scripts:

  • new jquery
  • angular
  • older jquery

I'm not sure if this will work, but from my understanding, Angular should use an existing jQuery.

+7
source

you can use the new ng-jq with angular 1.4.x to set the transition version to jQLite (angular internal jQuery)

+5
source

Source: https://habr.com/ru/post/952202/


All Articles