-
Notifications
You must be signed in to change notification settings - Fork 27.4k
compatibility with opal.js #2653
Comments
The code below (and the like) from opal.js cannot be good for other libraries Object.prototype.toString = function() {
return this.$to_s();
}; |
I've looked at this a little bit more, and it looks like all the incompatibilities can be reduced to two cases
The first of these is something that it is possible to work around, the only change needed is at the function if (!fn.$inject) {
// this means that we must be an array.
fn = fn[length];
} for if (isArray(fn)) {
fn = fn[length];
} with this change almost everything works. Note: All test were performed using jqLite, and it is expected that using jQuery there will be other incompatibilities that will need to be uncovered I think that this issue can be closed, if there is anything else, then or opal should behave better or developers that would like to use both libraries will have to be super careful and patch their local angular.js |
Thanks for digging into this :) |
Is there any way I can make this work right now or is this still usupported? |
@peterneubauer There are two options
BTW, the first option would be the option I think works best |
Thanks @lgalfaso , will try that! |
Just want to point out that
On my side I think that the |
If I read correctly, the current preferred approach by the Opal developers is to release code that monkey patches Angular.js. Given this, can I inquire as to why |
This change makes the code easier to read and also fixes a compatibility issue with opal.js which pollutes the global state by setting $inject property on Array prototype Closes angular#7904 Closes angular#2653
Hi,
While trying to load both opal and angularjs I got an error in angular.js with a really "helpful" message in the chrome console:
"Uncaught TypeError: object is not a function from ng"
Here is my minimal test page page:
opal alone works fine, angularjs alone works fine but with both loaded, boom !
If someone has any idea on what might be happening I am pretty lost as to what I could try.
The opal.js file can be found here: http://cdnjs.cloudflare.com/ajax/libs/opal/0.3.43/opal.js, I have tested this with angular 1.1.4.
The text was updated successfully, but these errors were encountered: