I've been working on developing a web app that involves multiple Angular ng-apps, and I want to use the same service code for at least two of them (even though they don't share data but perform similar functions). How can I prevent code duplication in this scenario? For example:
myApp1.factories.factory('myservice', [function(){
// code that I want to avoid repeating
}])
...and on another div on a different page within the app:
myApp2.factories.factory('myservice', [function(){
// code that I want to avoid repeating
}])
Is it possible to make both apps reuse the same service code? Alternatively, would it be recommended to have just one ng-app for all HTML elements (even if they may function independently) and organize things using controllers?
Thank you!