(17) The JQuery framework must be loaded before angularJS. jqueryangularjs
If our web page only introduces the angulrjs framework (not the jQuery framework), we may encounter the following errors during usage:
Error: [jqLite:nosel] Looking up elements via selectors is not supported by jqLite!
For example, in the following code, when we click the injector button, an error similar to the above will occur.
Error Code 1:
This is because the angular. element () API does not support selectors similar to jquery, that is, angular. element () does not support selector. It is best to introduce the JQuery framework, because it is too convenient to select elements from the jQuery framework. If you do not want to use jQuery, you can use document. querySelector () in HTML5. This API supports selector.
Code 1:
Note:
If jQuery and angular are used in the page, you must first load the jQuery framework and then load angular..
The following code loads angular and then jQuery. When you click the injector button, an error is returned:
TypeError: $(...).injector is not a function
Error Code 2:
If we load jQuery first and then angular, there will be no problem. This is because if the jQuery framework is not found during angular loading, the built-in jqlite will be used, so angular cannot inject injector (), scope () and other methods into jQuery objects.
Code 2:
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.