Reputation: 402
I'm working on a project that requires us to embed our AngularJS application to other websites. The application currently uses requireJs to load AngularJS. However, the current AngularJS attach the angular object to window and this can potentially cause conflict with other websites using their own version of AngularJS. I wonder if there's away we can manually place these the angular object into a specific namespace without breaking the code.
Upvotes: 3
Views: 250
Reputation: 8413
You may try renaming following in the source:
http://ajax.googleapis.com/ajax/libs/angularjs/1.0.6/angular.js
/** @name angular */
angular = window.angular || (window.angular = {}),
To something custom:
/** @name angular */
angular = window.angularX || (window.angularX = {}),
And then use renamed version in your code: angularX
.
Upvotes: 1