maxaon / angular-nanoscroller

Wrapper for nanoScrollerJS
MIT License
54 stars 39 forks source link

Check jqLite not working in angular#1.3.15 #10

Open upmauro opened 9 years ago

upmauro commented 9 years ago

The function below not work for check if angular using jqLite ot jQuery in the last version of angular.

Maybe we need change to check if element have a exclusive jquery methods.

  //jQuery must be used, cause angular method 'find' has different behavior
  if (angular.element !== $) {
    throw new Error("Angular must use jQuery not jqLite");
  }
codiak commented 8 years ago

+1 Angular 1.4.7 continues to throw this error.

A fix I found to work is replacing angular.element !== $ with: !angular.element.hasOwnProperty('fn')—giving you:

if (!angular.element.hasOwnProperty('fn')) {
    throw new Error("Angular must use jQuery not jqLite");
}

It successfully throws the error when jQuery is loaded after Angular, and jqLite is in use.