I believe there is a good reason to create a new instance of the object inside the service. We should also keep an open mind, and not just say that we should never do this, but singleton was created for this very reason . Controllers are created and destroyed frequently throughout the application life cycle, but services must be persistent.
I can present an example of use when you have some kind of workflow, for example, accepting a payment, and you have several properties, but now you have to change your type of payment because the customer’s credit card has failed and they need to be provided with another payment method. Of course, this has a lot to do with how you build your application. You could reset all the properties for the payment object, or you could create a new instance of the object in the service . But you do not need a new instance of the service, and you do not want to refresh the page.
I believe that the solution provides an object inside the service that you can create and install a new instance. But to be clear, a single instance of a service is important because a controller can be created and destroyed many times, but services require persistence. What you are looking for may not be a direct method in Angular, but a template for an object that you can manage inside your service.
As an example, I have a reset button. (This is not verified, it is really just a brief introduction to creating a new object in the service.
app.controller("PaymentController", ['$scope','PaymentService',function($scope, PaymentService) { $scope.utility = { reset: PaymentService.payment.reset() }; }]); app.factory("PaymentService", ['$http', function ($http) { var paymentURL = "https://www.paymentserviceprovider.com/servicename/token/" function PaymentObject(){ // this.user = new User(); /** Credit Card*/ // this.paymentMethod = ""; //... } var payment = { options: ["Cash", "Check", "Existing Credit Card", "New Credit Card"], paymentMethod: new PaymentObject(), getService: function(success, fail){ var request = $http({ method: "get", url: paymentURL } ); return ( request.then(success, fail) ); } //... } return { payment: { reset: function(){ payment.paymentMethod = new PaymentObject(); }, request: function(success, fail){ return payment.getService(success, fail) } } } }]);