title: Angular Js how to refresh a new factory instance
body: <p>I am using a factory to get list of folders and display it in the front end. Also in the front end i have form where i can add new folder to the existing list. After adding a folder i want to refresh my factory instance and display the updated folder list.</p>
  
  <p>// factory</p>
  
  <pre><code>angular.module('myapp').factory('archiveService', ['$http', 'ApiUrl', function($http, ApiUrl) {
  var archiveService = function() {
      this.repos = [];
      this.busy = false;
      this.page = 0;
  };
  archiveService.prototype.nextPage = function() {
      if (this.busy) return;
      this.busy = true;
      var url = ApiUrl.url + '/folders/?page=' + this.page;
      $http.get(url).then(function(res) {
          console.log(res);
          this.repos = res.data;
          if (items.repos == 0) {
              return;
          }
          this.page += 1
          this.busy = false;
      }.bind(this)).catch(function(data) {
      }.bind(this));
  };
  return {
      archiveService: archiveService,
  }
  </code></pre>
  
  <p>}]);</p>
  
  <p>// this is my controller</p>
  
  <pre><code>angular.module('myapp').controller('archiveModalController', ['$rootScope', '$scope','archiveService', function($rootScope, $scope, archiveService) {
  
  // I want to refresh this and show new data on update
  
      $scope.archivelist = new archiveService.archiveService();
  
  }])</code></pre>
  
  <p>I would like to know how can i refresh so i can get the new updated data</p>
  
  <p>$scope.archivelist = new archiveService.archiveService();</p>