$.fn.ngattr: $ is undefined
See original GitHub issueUsing the latest version 1.0.12 we get this (console) error when loading the plugin. We have jQuery loaded.
Notice that everything works ok Drag and drop is ok, nothing else fails, except that because of this error some other functions/plugins might fail like ng-touch for example. Notice that we are using jQuery 1.9.1 as we are forced to continue using it for some parts of this old, huge application, but it’s loaded after angularand it’s plugins (so we should be working with the associatd jqLite))
We “fixed” it by using the old version 1.0.11 and we found that i fact this is the piece of code which complains:
angular-dragdrop.js: 410
$.fn.ngattr = function(name, value) {
var element = this[0];
return element.getAttribute(name) || element.getAttribute('data-' + name);
};
If the first two lines are replaced by the old version which used prototyping it works:
angular.element.prototype.ngattr = function(name, value) {
var element = angular.element(this).get(0);
return element.getAttribute(name) || element.getAttribute('data-' + name);
};
As a side question, shouldn’t we pass angular.element instead of window.jQuery during initialization?
Issue Analytics
- State:
- Created 8 years ago
- Comments:6 (3 by maintainers)
Top GitHub Comments
I do not think that
$.fn
call would break anyway because jQuery is required. Have a demo?Closing it as it does not look like a bug. Please reopen if the problem persists.