angular.js icon indicating copy to clipboard operation
angular.js copied to clipboard

Add .noConflict() functionality

Open hekike opened this issue 11 years ago • 15 comments

  • add .noConflict() to the public api

hekike avatar Aug 13 '14 14:08 hekike

Up! Would love to see this feature landing in an upcoming release!

gergelyke avatar Aug 13 '14 14:08 gergelyke

We had this before, but it was removed last year (https://github.com/angular/angular.js/commit/9faabd1ba0b1929785bcf166dc0ff60008e7c442)

@matsko what was the reasoning for this, btw?

caitp avatar Aug 13 '14 14:08 caitp

@caitp yes but I've solved the "resolve global JSONP conflicts" issue with a random callback hash instead of counter. And I also create a fresh scope in every cases angular = window.angular = {}

hekike avatar Aug 13 '14 14:08 hekike

@caitp you can find the reason here: https://github.com/angular/angular.js/pull/2893

hekike avatar Aug 13 '14 14:08 hekike

I'm pretty sure this is going to break tests due to making callback IDs unpredictable (there are tests in httpBackendSpec.js which depend on this)

You'd need to mock Math.random() to make those work

caitp avatar Aug 13 '14 14:08 caitp

@caitp do you mean for this linecallbacks = {counter: 0};? Because it's just reset the counter, which I don't use :)

Running "tests:jqlite" (tests) task
INFO [karma]: Karma v0.12.9 server started at http://localhost:9876/
INFO [launcher]: Starting browser Chrome
INFO [Chrome 36.0.1985 (Mac OS X 10.9.4)]: Connected on socket aGnc95_afDkshaIXy3ib with id 96156252
Chrome 36.0.1985 (Mac OS X 10.9.4): Executed 1241 of 3059 SUCCESS (0 secs / 6.017 secs)
Chrome 36.0.1985 (Mac OS X 10.9.4): Executed 3059 of 3059 SUCCESS (12.411 secs / 12.782 secs)

Running "tests:jquery" (tests) task
INFO [karma]: Karma v0.12.9 server started at http://localhost:9876/
INFO [launcher]: Starting browser Chrome
INFO [Chrome 36.0.1985 (Mac OS X 10.9.4)]: Connected on socket 5q0Jst9Mm8q4CDhBy8a1 with id 9428067
Chrome 36.0.1985 (Mac OS X 10.9.4): Executed 1250 of 3068 SUCCESS (0 secs / 6.127 secs)
Chrome 36.0.1985 (Mac OS X 10.9.4): Executed 3068 of 3068 SUCCESS (13.013 secs / 13.359 secs)

Running "tests:modules" (tests) task
INFO [karma]: Karma v0.12.9 server started at http://localhost:9876/
INFO [launcher]: Starting browser Chrome
INFO [Chrome 36.0.1985 (Mac OS X 10.9.4)]: Connected on socket mEnyMG5XuTYT5i4XzAzr with id 37546992
Chrome 36.0.1985 (Mac OS X 10.9.4): Executed 429 of 429 SUCCESS (1.743 secs / 1.687 secs)

Done, without errors.

hekike avatar Aug 13 '14 15:08 hekike

No, I mean because you're generating a random key and adding it to the object rather than adding a predictable incremented number.

caitp avatar Aug 13 '14 15:08 caitp

But why do angular need an incremented number?

gergelyke avatar Aug 13 '14 15:08 gergelyke

Nah nevermind it should be fine, the tests use the replaced string to get the callbacks property name, so it doesn't matter.

caitp avatar Aug 13 '14 15:08 caitp

I'm sorry, but I wasn't able to verify your Contributor License Agreement (CLA) signature. CLA signature is required for any code contributions to AngularJS.

Please sign our CLA and ensure that the CLA signature email address and the email address in this PR's commits match.

If you signed the CLA as a corporation, please let us know the company's name.

Thanks a bunch!

PS: If you signed the CLA in the past then most likely the email addresses don't match. Please sign the CLA again or update the email address in the commit of this PR. PS2: If you are a Googler, please sign the CLA as well to simplify the CLA verification process.

mary-poppins avatar Aug 13 '14 15:08 mary-poppins

@mary-poppins sry my author email address was wrong. Now it's okay.

hekike avatar Aug 14 '14 09:08 hekike

CLA signature verified! Thank you!

Someone from the team will now triage your PR and it will be processed based on the determined priority (doc updates and fixes with tests are prioritized over other changes).

mary-poppins avatar Aug 14 '14 10:08 mary-poppins

Super interested in this feature. Hope it makes it in soon.

brandonburkett avatar Aug 28 '14 16:08 brandonburkett

Hello, I have been checking on this issue for a while now. Three months have passed since this PR, any chance to see this feature soon? it's a blocker for a lot of people who want to make third-party apps with Angular.

AoDev avatar Nov 19 '14 13:11 AoDev

+1 We would love to have this feature

americos avatar May 12 '15 19:05 americos